Add conf, update HTTP status codes script

This commit is contained in:
askiiart 2023-12-05 16:52:03 -06:00
parent e3164fe1de
commit e068210fff
Signed by untrusted user who does not match committer: askiiart
GPG key ID: BC3800E55FB54D67
5 changed files with 4217 additions and 23 deletions

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
rm -rf error/ rm -rf error/
git clone https://git.askiiart.net/askiiart/http-status-codes.git git clone https://git.askiiart.net/askiiart/http-status-codes.git
cp -r http-status-codes/pages/ . cd http-status-codes/
python3 nginx-create-pages.py
cp -r pages/ ..
cd ..
mv pages/ error/ mv pages/ error/
cp http-status-codes/you.gif assets/ cp http-status-codes/you.gif assets/
cp http-status-codes/boykisser.png assets/ cp http-status-codes/boykisser.png assets/

4071
bee-movie.txt Normal file

File diff suppressed because it is too large Load diff

141
default.conf Executable file
View file

@ -0,0 +1,141 @@
# goes in /etc/nginx/conf.d
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
if ($http_user_agent = "teapot") {
return 418;
}
if ($http_user_agent = "Expanse, a Palo Alto Networks company, searches across the global IPv4 space multiple times per day to identify customers' presences on the Internet. If you would like to be excluded from our scans, please send IP addresses/domains to: scaninfo@paloaltonetworks.com") {
return 418;
}
if ($http_user_agent = "SemrushBot") {
return 418;
}
# Aggressive ByteDance crawler that does not respect robots.txt - see https://youtu.be/Hi5sd3WEh0c
if ($http_user_agent ~ (Bytespider)) {
return 418;
}
# Rewrite OpenAI to bee movie script
if ($http_user_agent = "GPTBot") {
rewrite ^ /lol;
}
if ($http_user_agent = "CCBOT") {
rewrite ^ /lol;
}
if ($http_user_agent = "ChatGPT-User") {
rewrite ^ /lol;
}
if ($http_user_agent = "GPTBot") {
rewrite ^ /lol;
}
if ($http_user_agent = "Google-Extended") {
rewrite ^ /lol;
}
if ($http_user_agent = "Omgilibot") {
rewrite ^ /lol;
}
if ($http_user_agent = "Omgili") {
rewrite ^ /lol;
}
if ($http_user_agent = "FacebookBot") {
rewrite ^ /lol;
}
if ($http_user_agent ~ (OPX)) {
rewrite ^ /oprgx.html;
}
location /lol {
proxy_pass https://askiiart.net/bee-movie.txt;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location /ip {
return 200 "$remote_addr";
}
location /ip/json {
add_header Content-Type "application/json";
return 200 '{"ip":"$remote_addr"}';
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
error_page 500 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location /.git {
# There is no standard way to present options, but in the rare cases that 300 is used it just has a list of links. The Location header is for preferred thing.
add_header Location "https://git.askiiart.net/askiiart/askiiart-net";
return 300 '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"></head><body><a href="https://git.askiiart.net/askiiart/askiiart-net">Self-hosted</a><br><a href="https://github.com/askiiart/askiiart-net">GitHub</a></body></html>';
}
error_page 300 /error/300.html;
error_page 301 /error/301.html;
error_page 401 /error/401.html;
error_page 402 /error/402.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 406 /error/406.html;
error_page 410 /error/410.html;
error_page 413 /error/413.html;
error_page 417 /error/417.html;
error_page 418 /error/418.html;
error_page 423 /error/423.html;
error_page 425 /error/425.html;
error_page 429 /error/429.html;
error_page 451 /error/451.html;
error_page 502 /error/502.html;
error_page 508 /error/508.html;
}

View file

@ -1,24 +1,3 @@
User-agent: * User-agent: *
Disallow: /wishlist.md Disallow: /wishlist.md
Disallow: /wishlist.html Disallow: /wishlist.html
User-agent: CCBot
Disallow: /
User-agent: ChatGPT-User
Disallow: /
User-agent: GPTBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: Omgilibot
Disallow: /
User-agent: Omgili
Disallow: /
User-agent: FacebookBot
Disallow: /