mirror of
https://git.bakhai.co.in/FbIN/4Get.git
synced 2025-11-08 05:00:06 +05:30
commit
c6e404d2af
132 changed files with 34951 additions and 0 deletions
195
docs/apache2-example.md
Normal file
195
docs/apache2-example.md
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
# Sample Apache2 configuration
|
||||
This is the apache2 configuration file used on the 4g.flossboxin.org.in official instance, in hopes that it's useful to you!
|
||||
|
||||
Looking for the apache2 guide? <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/apache2.md">go here.</a>.
|
||||
|
||||
```xml
|
||||
<VirtualHost *:443>
|
||||
ServerName www.4g.flossboxin.org.in
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
RedirectMatch 301 ^(.*)$ https://4g.flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName 4g.flossboxin.org.in
|
||||
|
||||
ServerAdmin dev@flossboxin.org.in
|
||||
DocumentRoot /var/www/4get
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
<Directory /var/www/4get>
|
||||
Options -MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||
</Directory>
|
||||
|
||||
# deny access to private resources
|
||||
<Directory /var/www/4get/data/>
|
||||
Order Deny,allow
|
||||
Deny from all
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName www.flossboxin.org.in
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
RedirectMatch 301 ^(.*)$ https://flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName flossboxin.org.in
|
||||
|
||||
ServerAdmin dev@flossboxin.org.in
|
||||
DocumentRoot /var/www/flossboxin
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
<Directory /var/www/flossboxin>
|
||||
Options -MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName www.nyym.co
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/letsencrypt/live/nyym.co/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/nyym.co/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/nyym.co/chain.pem
|
||||
|
||||
RedirectMatch 301 ^(.*)$ https://nyym.co$1
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName nyym.co
|
||||
|
||||
ServerAdmin will@lolcat.ca
|
||||
DocumentRoot /var/www/nyym
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/nyym.co/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/nyym.co/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/nyym.co/chain.pem
|
||||
|
||||
<Directory /var/www/nyym>
|
||||
Options -MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName git.flossboxin.org.in
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests off
|
||||
AllowEncodedSlashes NoDecode
|
||||
ProxyPass / http://localhost:3000/ nocanon
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost *:443>
|
||||
ServerName live.lolcat.ca
|
||||
|
||||
ServerAdmin will@lolcat.ca
|
||||
DocumentRoot /var/www/live
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
</VirtualHost>
|
||||
```
|
||||
216
docs/apache2.md
Normal file
216
docs/apache2.md
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
# Install guide for Apache2 webserver
|
||||
Welcome to the new and revamped 4get install manual for apache2. Even if you already have services running on an existing installation of apache2, you should still be able to adapt this guide to your needs.
|
||||
|
||||
For starters, login as `root`.
|
||||
|
||||
Then, install the following dependencies:
|
||||
```sh
|
||||
apt update
|
||||
apt upgrade
|
||||
apt install php-mbstring apache2 certbot php-imagick imagemagick php-curl curl php-apcu git libapache2-mod-php
|
||||
```
|
||||
|
||||
Enable the required modules:
|
||||
```sh
|
||||
a2enmod ssl
|
||||
a2enmod rewrite
|
||||
```
|
||||
|
||||
And enable these optional ones, which might be useful to you later on. The `proxy` module is useful for setting up reverse proxies to services like gitea, and `headers` is useful to tweak global header values:
|
||||
```sh
|
||||
a2enmod proxy
|
||||
a2enmod headers
|
||||
```
|
||||
|
||||
Now, restart apache2:
|
||||
```sh
|
||||
service apache2 restart
|
||||
```
|
||||
|
||||
Just for good measure, please check if your webserver is running. Access it through HTTP, not HTTPS. You should see the apache2 default landing page.
|
||||
|
||||
## 000-default.conf
|
||||
Now, edit the following file: `/etc/apache2/sites-available/000-default.conf`, remove everything and carefully add each rule specified here, while making sure to replace my domains with your own:
|
||||
|
||||
1. The `VirtualHost` here instructs apache2 to redirect all **HTTP** traffic that specify an unknown `Host` header be redirected to a specific domain of your choice. Configuring this is not required but highly recommended.
|
||||
```xml
|
||||
<VirtualHost *:80>
|
||||
# no domain = go to 4g.flossboxin.org.in
|
||||
RedirectMatch 301 ^(.*)$ https://4g.flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
2. This instruction tells apache2 to redirect all HTTP traffic on `Host` flossboxin.org.in to the HTTPS version of the site. You should add a rule like this for all of your services explicitly.
|
||||
```xml
|
||||
<VirtualHost *:80>
|
||||
ServerName flossboxin.org.in
|
||||
RedirectMatch 301 ^(.*)$ https://flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
3. Subdomains won't be matched by the above rule, so I recommend you also add them to be more explicit:
|
||||
```xml
|
||||
<VirtualHost *:80>
|
||||
ServerName www.flossboxin.org.in
|
||||
RedirectMatch 301 ^(.*)$ https://flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
... Etc, for every service you own.
|
||||
|
||||
4. And finally, append this configuration if you wish to host a tor or i2p access point. This configuration should not be binded to SSL(443) as Let's Encrypt does not let you create certificates for onion sites:
|
||||
```xml
|
||||
<VirtualHost *:80>
|
||||
# tor site
|
||||
ServerName 4getwebfrq5zr4sxugk6htxvawqehxtdgjrbcn2oslllcol2vepa23yd.onion
|
||||
|
||||
# compress
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
DocumentRoot /var/www/4get
|
||||
|
||||
Options -MultiViews
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||
|
||||
# deny access to private resources
|
||||
<Directory /var/www/4get/data/>
|
||||
Order Deny,allow
|
||||
Deny from all
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
```
|
||||
To make the above snippet work, please refer to our <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/tor.md">tor site guide</a>.
|
||||
|
||||
## default-ssl.conf
|
||||
Now, edit the file `/etc/apache2/sites-available/default-ssl.conf`, remove everything and, again, add each rule while modifying the relevant fields:
|
||||
|
||||
First, append the following redirect rule to point traffic from `www.4g.flossboxin.org.in` to `4g.flossboxin.org.in`:
|
||||
```xml
|
||||
<VirtualHost *:443>
|
||||
ServerName www.4g.flossboxin.org.in
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
RedirectMatch 301 ^(.*)$ https://4g.flossboxin.org.in$1
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
This ruleset tells apache2 where 4get is located (`/var/www/4get`), ensures that `4g.flossboxin.org.in/settings` resolves to `4g.flossboxin.org.in/settings.php` internally and that we deny access to `/data/*`, which may contain files you might want to keep private. `StdEnvVArs+` will make it so that PHP can view if the connection uses HTTPS, and which cipher was used. Useful for basic bot protection.
|
||||
|
||||
Make sure to replace `4g.flossboxin.org.in` with your own domain under the `SSLCertificate*` directives!
|
||||
```xml
|
||||
<VirtualHost *:443>
|
||||
ServerName 4g.flossboxin.org.in
|
||||
|
||||
ServerAdmin dev@flossboxin.org.in
|
||||
DocumentRoot /var/www/4get
|
||||
|
||||
SSLEngine On
|
||||
SSLOptions +StdEnvVars
|
||||
|
||||
#ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
|
||||
AddOutputFilterByType DEFLATE application/json
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
|
||||
SSLCertificateFile /etc/letsencrypt/live/4g.flossboxin.org.in/fullchain.pem
|
||||
SSLCertificateKeyFile /etc/letsencrypt/live/4g.flossboxin.org.in/privkey.pem
|
||||
SSLCertificateChainFile /etc/letsencrypt/live/4g.flossboxin.org.in/chain.pem
|
||||
|
||||
<Directory /var/www/4get>
|
||||
Options -MultiViews
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^([^\.]+)$ $1.php [NC,L]
|
||||
</Directory>
|
||||
|
||||
# deny access to private resources
|
||||
<Directory /var/www/4get/data/>
|
||||
Order Deny,allow
|
||||
Deny from all
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
By default, the first rule dictates where traffic should be redirected to in case the client specifies an unknown domain name. Don't forget your webserver's other rules! For a complete real-world example, please <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/apache2-example.md">check out my real-world config file I use on 4g.flossboxin.org.in</a>.
|
||||
|
||||
## security.conf
|
||||
If you enabled the `headers` module, you can head over to `/etc/apache2/conf-enabled/security.conf` and edit:
|
||||
```sh
|
||||
ServerTokens Prod # instead off Full
|
||||
```
|
||||
and
|
||||
```sh
|
||||
ServerSignature Off #instead of On
|
||||
```
|
||||
This will ensure that the `Server` header apache2 returns is minimal and doesn't leak information like your host system's OS or apache2 version.
|
||||
|
||||
You can also uncomment `Header set X-Content-Type-Options: "nosniff"` and `Header set Content-Security-Policy "frame-ancestors 'self';"` respectively.
|
||||
|
||||
## charset.conf
|
||||
Head over to `/etc/apache2/conf-enabled/charset.conf` and uncomment `AddDefaultCharset UTF-8`.
|
||||
|
||||
## other-vhost-access-log.conf
|
||||
Since none of our configuration files contains any `CustomLog` directives, all we need to do to disable logging entirely is comment out the `CustomLog` directive located in `/etc/apache2/conf-enabled/other-vhost-access-log.conf`. Only error logs will remain if you configured them.
|
||||
|
||||
## Symlink everything
|
||||
Now comes the most important part of the setup. Run
|
||||
```sh
|
||||
ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
|
||||
```
|
||||
Otherwise apache2 will ignore our SSL configuration. Handy, huh?
|
||||
|
||||
# Setup SSL
|
||||
Great, now we've configured the webserver, but we still don't have our security certificate. Let's generate one!
|
||||
|
||||
First, stop `apache2`.
|
||||
```sh
|
||||
service apache2 stop
|
||||
```
|
||||
|
||||
Now, run `certbot`, and specify all of your domains by prepending `-d` every time. Make sure the first domain you specify is your main domain, and the same domain you specified in the configuration above! We use ECDSA encryption here as it's better than RSA.
|
||||
```sh
|
||||
certbot certonly --standalone --key-type ecdsa -d 4g.flossboxin.org.in -d www.4g.flossboxin.org.in -d flossboxin.org.in -d www.flossboxin.org.in
|
||||
```
|
||||
|
||||
Certbot should ask you a few questions, just play along. At the end of the setup, certbot should tell you about the location of the certificates. Double check to make sure they correspond to the paths we specified in `default-ssl.conf`. Your certificates should now update every 2-3 months automatically.
|
||||
|
||||
After this is complete, create a directory in `/var/www/4get`.
|
||||
|
||||
Now, start `apache2`.
|
||||
```sh
|
||||
service apache2 start
|
||||
```
|
||||
|
||||
Congratulations! You now have a... 404 error on your webserver, if everything went well. Now's the time to make sure all of our redirect rules work!
|
||||
|
||||
# Import the fun junk
|
||||
Run these commands:
|
||||
```
|
||||
cd /var/www/4get
|
||||
git clone https://git.flossboxin.org.in/FbIN/4get
|
||||
chmod 777 -R icons/
|
||||
```
|
||||
|
||||
... And try accessing your webserver. You should now have a working 4get instance!
|
||||
|
||||
Please make sure to check out how to further <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/configure.md">configure 4get</a> to your liking!
|
||||
58
docs/caddy.md
Normal file
58
docs/caddy.md
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Install guide for Caddy webserver
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
`sudo apt install caddy php8.2-dom php8.2-imagick imagemagick php8.2-curl curl php8.2-apcu git`
|
||||
|
||||
2. Clone this repository where you want to host this from:
|
||||
|
||||
`cd /var/www && sudo git clone https://git.konakona.moe/diowo/4get`
|
||||
|
||||
3. Set permission on the `icons` directory inside `4get`
|
||||
|
||||
`cd /var/www/4get/ && sudo chmod 777 -R icons/`
|
||||
|
||||
4. Add an entry for 4get on your Caddyfile at `/etc/caddy/Caddyfile`
|
||||
|
||||
```sh
|
||||
4get.konakona.moe {
|
||||
root * /var/www/4get
|
||||
file_server
|
||||
encode gzip
|
||||
php_fastcgi unix//var/run/php/php8.2-fpm.sock {
|
||||
index index.php
|
||||
}
|
||||
redir /{path}.php{query} 301
|
||||
try_files {path} {path}.php
|
||||
}
|
||||
```
|
||||
|
||||
Caddy deals with SSL certificates automatically so you don't have to mess with anything. Also if needed, a sample of my Caddyfile can be found [here](https://git.konakona.moe/diowo/misc/src/branch/main/etc/caddy/Caddyfile).
|
||||
|
||||
5. Restart Caddy
|
||||
|
||||
`sudo systemctl restart caddy`
|
||||
|
||||
# Encryption setup
|
||||
I'm schizoid (as you should) so I'm gonna setup 4096bit key encryption. To complete this step, you need a domain or subdomain in your possession. Make sure that the DNS shit for your domain has propagated properly before continuing, because certbot is a piece of shit that will error out the ass once you reach 5 attempts under an hour.
|
||||
|
||||
## Encryption setup on Apache
|
||||
|
||||
```sh
|
||||
certbot --apache --rsa-key-size 4096 -d www.yourdomain.com -d yourdomain.com
|
||||
```
|
||||
When it asks to choose a vhost, choose the option with "HTTPS" listed. Don't setup HTTPS for tor, we don't need it (it doesn't even work anyways with let's encrypt)
|
||||
|
||||
Edit `000-default-le-ssl.conf`
|
||||
|
||||
Add this at the end:
|
||||
```xml
|
||||
<Directory /var/www/html/4get>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME}.php -f
|
||||
RewriteRule (.*) $1.php [L]
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
```
|
||||
63
docs/configure.md
Normal file
63
docs/configure.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# 4Get configuation options
|
||||
|
||||
Welcome! This guide assumes that you have a working 4get instance. This will help you configure your instance to the best it can be!
|
||||
|
||||
# Files location
|
||||
1. The main configuration file is located at `data/config.php`
|
||||
2. The proxies are located in `data/proxies/*.txt`
|
||||
3. The captcha imagesets are located in `data/captcha/your_image_set/*.png`
|
||||
4. The captcha font is located in `data/fonts/captcha.ttf`
|
||||
|
||||
# Cloudflare bypass (TLS check)
|
||||
**Note: this only allows you to bypass the browser integrity checks. Captchas & javascript challenges will not be bypassed.**
|
||||
|
||||
Configuring this lets you fetch images sitting behind Cloudflare and allows you to scrape the **Yep** & the **Mwmbl** search engines. Please be aware that APT will fight against you and will re-install the openSSL-version of curl constantly when updating.
|
||||
|
||||
First, follow these instructions. Only install the Firefox modules:
|
||||
|
||||
https://github.com/lwthiker/curl-impersonate/blob/main/INSTALL.md#native-build
|
||||
|
||||
Once you did this, you should be able to run the following inside your terminal:
|
||||
|
||||
```sh
|
||||
$ curl_ff117 --version
|
||||
curl 8.1.1 (x86_64-pc-linux-gnu) libcurl/8.1.1 NSS/3.92 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 nghttp2/1.56.0
|
||||
Release-Date: 2023-05-23
|
||||
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
|
||||
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe UnixSockets zstd
|
||||
```
|
||||
Now, after compiling, you should have a `libcurl-impersonate-ff.so` sitting somewhere. Mine (on my debian install) is located at `/usr/local/lib/libcurl-impersonate-ff.so`.
|
||||
|
||||
Find the `libcurl.so.4` file used by your current installation of curl. For me, this file is located at `/usr/lib/x86_64-linux-gnu/libcurl.so.4`
|
||||
|
||||
Now comes the sketchy part: replace `libcurl.so.4` with `libcurl-impersonate-ff.so`. You can do this in the following way:
|
||||
```sh
|
||||
sudo rm /usr/lib/x86_64-linux-gnu/libcurl.so.4
|
||||
sudo cp /usr/local/lib/libcurl-impersonate-ff.so /usr/lib/x86_64-linux-gnu/libcurl.so.4
|
||||
```
|
||||
|
||||
Make sure to restart your webserver and/or PHP daemon, otherwise it will keep using the old library. You should now be able to bypass Cloudflare's shitty checks!!
|
||||
|
||||
# Robots.txt
|
||||
Make sure you configure this right to optimize your search engine presence! Head over to `/robots.txt` and change the `4g.flossboxin.org.in` domain to your own domain.
|
||||
|
||||
# Proxies
|
||||
4get supports rotating proxies for scrapers! Configuring one is really easy.
|
||||
|
||||
1. Head over to the **proxies** folder. Give it any name you want, like `myproxy`, but make sure it has the `txt` extension.
|
||||
2. Add your proxies to the file. Examples:
|
||||
```conf
|
||||
# format -> <protocol>:<address>:<port>:<username>:<password>
|
||||
# protocol list:
|
||||
# raw_ip, http, https, socks4, socks5, socks4a, socks5_hostname
|
||||
socks5:1.1.1.1:juicy:cloaca00
|
||||
http:1.3.3.7::
|
||||
raw_ip::::
|
||||
```
|
||||
3. Go to the **main configuration file**. Then, find which website you want to setup a proxy for.
|
||||
4. Modify the value `false` with `"myproxy"`, with quotes included and the semicolon at the end.
|
||||
|
||||
Done! The scraper you chose should now be using the rotating proxies. When asking for the next page of results, it will use the same proxy to avoid detection!
|
||||
|
||||
## Important!
|
||||
If you ever test out a `socks5` proxy locally on your machine and find out it works but doesn't on your server, try supplying the `socks5_hostname` protocol instead. Hopefully this tip can save you 3 hours of your life!
|
||||
194
docs/nginx.md
Normal file
194
docs/nginx.md
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
<h1 align=center>Installation of 4get in NGINX</h1>
|
||||
|
||||
<div align=right>
|
||||
|
||||
> NOTE: As the previous version stated, it is better to follow the <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/apache2.md">Apache2 guide</a> instead of the Nginx one.
|
||||
|
||||
> NOTE: This is going to guess that you're using either a <abbr title="(Arch Linux, Artix Linux, Endeavouros, etc...) ">Arch-based system</abbr> or a <abbr title="(Debian, Ubuntu, Devuan, etc...)">Debian-based system</abbr>, although you can still follow it with minor issues.
|
||||
|
||||
</div>
|
||||
|
||||
1. Login as root.
|
||||
2. Upgrade your system:
|
||||
* On Arch-based, run `pacman -Syu`.
|
||||
* On Debian-based, run `apt update`, then `apt upgrade`.
|
||||
3. Install the following dependencies:
|
||||
* `git`: So you can clone <a href="https://git.flossboxin.org.in/FbIN/4get">this</a> repository.
|
||||
* `nginx`: So you can run Nginx.
|
||||
* `php-fpm`: This is what allows Nginx to run *(and show)* PHP files.
|
||||
* `php-imagick`, `imagemagick`: Image manipulation.
|
||||
* `php-apcu`: Caching module.
|
||||
* `php-curl`, `curl`: Transferring data with URLs.
|
||||
* `php-mbstring`: String utils.
|
||||
* `certbot`, `certbot-nginx`: ACME client. Used to create SSL certificates.
|
||||
* In Arch-based distributions:
|
||||
* `pacman -S nginx certbot php-imagick certbot-nginx imagemagick curl php-apcu git`
|
||||
* In Debian-based distributions:
|
||||
* `apt install php-mbstring nginx certbot-nginx certbot php-imagick imagemagick php-curl curl php-apcu git`
|
||||
|
||||
<div align=right>
|
||||
|
||||
> IMPORTANT: `php-curl`, `php-mbstring` might be a Debian-only package, but this needs further fact checking.
|
||||
|
||||
> IMPORTANT: If having issues with `php-apcu` or `libsodium`, go to [^1].
|
||||
|
||||
</div>
|
||||
|
||||
4. `cd` to `/etc/nginx` and make the `conf.d/` directory if it doesn't exist:
|
||||
* Again, this guesses you're logged in as root.
|
||||
```sh
|
||||
cd /etc/nginx
|
||||
ls -l conf.d/ # If ls shows conf.d, then it means it exists.
|
||||
# If it does not, run:
|
||||
mkdir conf.d
|
||||
```
|
||||
5. Make a file inside `conf.d/` called `4get.conf` and place the following content:
|
||||
* First run `touch conf.d/4get.conf` then `nano conf.d/4get.conf` to open the nano editor: *(Install it if it is not, or use another editor.)*
|
||||
```sh
|
||||
server {
|
||||
access_log /dev/null; # Search log file. Do you really need to?
|
||||
error_log /dev/null; # Error log file.
|
||||
|
||||
# Change this if you have 4get in another folder.
|
||||
root /var/www/4get;
|
||||
# Change 'yourdomain' to your domain.
|
||||
server_name www.yourdomain.com yourdomain.com;
|
||||
# Port to listen to.
|
||||
listen 80;
|
||||
|
||||
location @php {
|
||||
try_files $uri.php $uri/index.php =404;
|
||||
# Change the unix socket address if it's different for you.
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
# Change this to `fastcgi_params` if you use a debian based distribution.
|
||||
include fastcgi.conf;
|
||||
fastcgi_intercept_errors on;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri @php;
|
||||
}
|
||||
|
||||
location ~* ^(.*)\.php$ {
|
||||
return 301 $1;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
* The above is a very basic configuration and thus will need tweaking to your personal needs. It should still work as-is, though. A 'real world' example is present in [^2].
|
||||
* After saving the file, check that the `nginx.conf` file inside the main directory includes files inside `conf.d/`:
|
||||
* It should be inside the the http block: *(The following is an example! Don't just Copy and Paste it!)*
|
||||
```sh
|
||||
http {
|
||||
include mime.types;
|
||||
include conf.d/*.conf;
|
||||
types_hash_max_size 4096;
|
||||
# ...
|
||||
}
|
||||
```
|
||||
* Now, test your configuration with `nginx -t`, if it says that everything is good, restart *(or start)* the Nginx daemon:
|
||||
* This depends on the init manager, most distributions use `systemd`, but it's better practice to include most.
|
||||
```sh
|
||||
# systemd
|
||||
systemctl stop nginx
|
||||
systemctl start nginxt
|
||||
# or
|
||||
systemctl restart nginx
|
||||
|
||||
# openrc
|
||||
rc-service nginx stop
|
||||
rc-service nginx start
|
||||
# or
|
||||
rc-service nginx restart
|
||||
|
||||
# runit
|
||||
sv down nginx
|
||||
sv up nginx
|
||||
# or
|
||||
sv restart nginx
|
||||
|
||||
# s6
|
||||
s6-rc -d change nginx
|
||||
s6-rc -u change nginx
|
||||
# or
|
||||
s6-svc -r /run/service/nginx
|
||||
|
||||
# dinit
|
||||
dinitctl stop nginx
|
||||
dinitctl start nginx
|
||||
# or
|
||||
dinitctl restart nginx
|
||||
```
|
||||
6. Clone the repository to `/var/www`:
|
||||
* `git clone --depth 1 https://git.flossboxin.org.in/FbIN/4get 4get` - It clones the repository with the depth of one commit *(so it takes less time to download)* and saves the cloned repository as '4get'.
|
||||
7. That should be it! There are some extra steps you can take, but it really just depends on you.
|
||||
|
||||
<h2 align=center>Encryption setup</h2>
|
||||
|
||||
1. Generate a certificate for the domain you're using with:
|
||||
* Note that `certbot-nginx` is needed.
|
||||
```sh
|
||||
certbot --nginx --key-type ecdsa -d www.yourdomain.com -d yourdomain.com
|
||||
```
|
||||
2. After that, certbot will deploy the certificate automatically to your 4get conf file; It should be ready to use from there.
|
||||
|
||||
<h2 align=center>Tor Setup</h2>
|
||||
|
||||
<div align=right>
|
||||
|
||||
> IMPORTANT: Tor onion addresses are very long compared to traditional domains, so, Before doing anything, edit `nginx.conf` and increase <abbr title="This setting in your Nginx configuration controls the internal data structure used to manage multiple server names (hostnames) associated with your web server. Each hostname requires a certain amount of memory within this structure. If the size is insufficient, Nginx will encounter errors."><code>server_names_hash_bucket_size</code></abbr> to your needs.
|
||||
|
||||
</div>
|
||||
|
||||
1. `cd` to `/etc/nginx` *(if you haven't)* and open your `nginx.conf` file.
|
||||
2. Find the line containing `# server_names_hash_bucket_size 64;` inside said file.
|
||||
3. Uncomment the line and adjust the value; start with 64, but if you encounter issues, incrementally increase it *(e.g., 128, 256)* until it accommodates your configuration.
|
||||
4. Open *(or duplicate the configuration)* and edit it:
|
||||
* Example configuration, again:
|
||||
```sh
|
||||
server {
|
||||
access_log /dev/null; # Search log file. Do you really need to?
|
||||
error_log /dev/null; # Error log file.
|
||||
|
||||
# Change this if you have 4get in another folder.
|
||||
root /var/www/4get;
|
||||
# Change 'onionadress.onion' to your onion link.
|
||||
server_name onionadress.onion;
|
||||
# Port to listen to.
|
||||
listen 80;
|
||||
|
||||
location @php {
|
||||
try_files $uri.php $uri/index.php =404;
|
||||
# Change the unix socket address if it's different for you.
|
||||
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
# Change this to `fastcgi_params` if you use a debian based distribution.
|
||||
include fastcgi.conf;
|
||||
fastcgi_intercept_errors on;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri @php;
|
||||
}
|
||||
|
||||
location ~* ^(.*)\.php$ {
|
||||
return 301 $1;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
A real world example is present in [^2].
|
||||
5. Once done, check the configuration with `nginx -t`. If everything's fine and dandy, refer to <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/tor.md">the Tor guide</a> to setup your onion site.
|
||||
|
||||
<h2 align=center>Other important things</h2>
|
||||
|
||||
1. <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/configure.md">Configuration guide</a>: Things to do after setup.
|
||||
2. <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/apache2.md">Apache2 guide</a>: Fallback to this if you couldn't get something to work, or you don't know something.
|
||||
|
||||
<h2 align=center>Known issues</h2>
|
||||
|
||||
1. https://git.lolcat.ca/lolcat/4get/issues
|
||||
|
||||
[^1]: lolcat/4get#40, If having issues with `libsodium`, or `php-apcu`.
|
||||
[^2]: <a href="https://git.nadeko.net/Fijxu/etc-configs/src/branch/selfhost/nginx/conf.d/4get.conf">git.nadeko.net</a> nadeko.net's 4get instance configuration.
|
||||
16
docs/tor.md
Normal file
16
docs/tor.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Tor setup
|
||||
This guide assumes that there is already a configured webserver sitting on port 80 waiting for localhost connections. The <a href="https://git.flossboxin.org.in/FbIN/4get/src/branch/main/docs/apache2.md">apache2 guide</a> guides you through this.
|
||||
|
||||
1. Login as `root`.
|
||||
2. Install `tor`.
|
||||
3. Edit `/etc/tor/torrc`
|
||||
4. Go to the line that contains `HiddenServiceDir` and `HiddenServicePort`, uncomment those 2 lines and set them like this:
|
||||
```
|
||||
HiddenServiceDir /var/lib/tor/4get
|
||||
HiddenServicePort 80 127.0.0.1:80
|
||||
```
|
||||
5. Restart the tor service using `service tor restart`
|
||||
6. Wait for a while...
|
||||
7. Run `cat /var/lib/tor/4get/hostname`. That is your onion address!
|
||||
|
||||
# Specify your own tor address
|
||||
Loading…
Add table
Add a link
Reference in a new issue