Self-Host

To Self-host @ https://link.flossboxin.org.in
This commit is contained in:
vdbhb59 2025-02-21 21:50:36 +05:30
commit c9898cf261
95 changed files with 5217 additions and 0 deletions

75
docs/README.md Normal file
View file

@ -0,0 +1,75 @@
# Installing
To host FbIN-LibreY using your OS's native package manager and PHP+NGINX, you can use the following steps as a guide.
These instructions are specific to Debian GNU/Linux but should be similar on most *nix variants (differences may include commands for package management, init system, php-fpm.sock location and availability of fastcgi-php.conf)
Install the packages (Debian GNU/Linux):
```sh
apt install php php-fpm php-dom php-curl php-apcu nginx git
```
Install the packages (Arch Linux):
```sh
pacman -S php php-fpm php-apcu nginx git
```
Clone FbIN-LibreY:
```sh
mkdir -p /var/www/html
git clone https://git.flossboxin.org.in/FbIN/LibreY.git /var/www/html/LibreY
```
Rename the config and opensearch files, edit manually if needed:
```sh
cd /var/www/html/LibreY/
mv config.php.example config.php
mv opensearch.xml.example opensearch.xml
```
Change opensearch.xml to point to your domain:
```sh
sed -i 's/http:\/\/localhost:80/https:\/\/your.domain/g' opensearch.xml
```
An nginx configuration similar to the one below should be placed in your `http { ... }` block or a file that is automatically detected as such.
```sh
server {
listen 80;
server_name your.domain;
root /var/www/html/LibreY;
index index.php;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
```
You can optionally remove the .php extension in URLs by adding this code your `server { ... }` block.
```sh
location / {
try_files $uri $uri/ @extensionless-php;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
```
Start php-fpm and nginx immediately and on every boot:
```sh
systemctl enable --now php-fpm nginx
```
Now FbIN-LibreY should be running at the port you specified!

62
docs/system-tor-proxy.md Normal file
View file

@ -0,0 +1,62 @@
> [!IMPORTANT]
> Please note that this heavily relies on [@codedipper](https://github.com/codedipper)'s [work and is basically a copy of his wiki](https://github.com/codedipper/LibreY-Tor/wiki/LibreY-Tor-Proxy--System-tor).
0. This was tested on an Arch Linux setup, packages `base` and `tor` must be installed to get the proxy working.\
FbIN-LibreY has other requirements as well.\
Slight differences in Tor configurations may be needed across different systems.
1. Create `/etc/tor/torrc` and edit it to your liking
```
SOCKSPort 127.0.0.1:9050
SOCKSPolicy accept 127.0.0.1/32
SOCKSPolicy reject *
DataDirectory /var/lib/tor
User tor
Log notice stdout
RunAsDaemon 0
# UseBridges 1
# Bridge xx.xxx.xxx.xxx:xx
```
2. Secure directory permissions
```
chown -R tor: /usr/share/tor
chown -R tor: /var/lib/tor
chown -R tor: /etc/tor
chmod -R 0700 /usr/share/tor
chmod -R 0700 /var/lib/tor
chmod -R 0700 /etc/tor
```
3. Start Tor and enable it on boot
```
systemctl enable --now tor.service
```
4. Install FbIN-LibreY
https://git.flossboxin.org.in/FbIN/LibreY/src/branch/main/docs#readme
5. Edit configuration files
In your `config.php`, uncomment and change the following options to match the port you're running Tor on.
```
// CURLOPT_PROXY => "ip:port",
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
```
For our configuration, they would be changed to:
```
CURLOPT_PROXY => "127.0.0.1",
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5_HOSTNAME,
```
6. Start FbIN-LibreY! You can use a tool like [iftop](https://archlinux.org/packages/extra/x86_64/iftop/) to make sure your FbIN-LibreY instance is connecting to guard nodes or a bridge instead of Google servers.
To update Tor and FbIN-LibreY:
```
pacman -Syu
git pull
```