Add run.sh and nginx config
This commit is contained in:
parent
c9c8afcca1
commit
0c8f0d1edd
2 changed files with 63 additions and 0 deletions
47
nginx/default.conf
Normal file
47
nginx/default.conf
Normal file
|
@ -0,0 +1,47 @@
|
|||
server {
|
||||
listen 6000;
|
||||
listen [::]:6000;
|
||||
server_name localhost;
|
||||
|
||||
# Rewrite OpenAI to bee movie script
|
||||
if ($http_user_agent = "GPTBot") {
|
||||
rewrite ^ /lol;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if ($http_user_agent ~ (Bytespider)) {
|
||||
return 418;
|
||||
}
|
||||
|
||||
location /lol {
|
||||
proxy_pass https://courses.cs.washington.edu/courses/cse163/20wi/files/lectures/L04/bee-movie.txt;
|
||||
}
|
||||
location / {
|
||||
root /usercode/this-site-runs-on-a-textbook;
|
||||
index index.html index.htm;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
autoindex_localtime on;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usercode/this-site-runs-on-a-textbook;
|
||||
}
|
||||
|
||||
# Redirect .git to source
|
||||
#
|
||||
location ~ /\.git {
|
||||
return 308 https://github.com/askiiart/this-site-runs-on-a-textbook;
|
||||
}
|
||||
}
|
16
run.sh
Normal file
16
run.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
sudo cp /usercode/this-site-runs-on-a-textbook/nginx/default.conf /etc/nginx/conf.d
|
||||
sudo nginx
|
||||
# Remote port forwarding in the background
|
||||
ssh -fN -R 6000:localhost:6000 root@askiiart.net -i /usercode/ssh/id_rsa
|
||||
|
||||
# Keeps it alive
|
||||
while :
|
||||
do
|
||||
touch /usercode/keep-alive
|
||||
sleep 5
|
||||
echo "bap! bap! bap! bap! stayin' alive! stayin' alive!" > /usercode/keep-alive
|
||||
sleep 5
|
||||
rm -f /usercode/keep-alive
|
||||
sleep 5
|
||||
done
|
Loading…
Reference in a new issue