diff options
author | Runxi Yu <me@runxiyu.org> | 2024-05-11 22:06:28 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-05-11 22:06:28 +0800 |
commit | 337cdb29b6082b92fb21470cbe4fcc495f49ae94 (patch) | |
tree | f2886eeb286e5afccc06625a8d881a6e4a82c701 | |
parent | 88506b73ee0d5496d3b7d286edc7e2984f3edc73 (diff) | |
download | www-337cdb29b6082b92fb21470cbe4fcc495f49ae94.tar.gz |
Add Nginx config
-rwxr-xr-x | hybrid.cgi | 2 | ||||
-rw-r--r-- | nginx-site.conf | 40 |
2 files changed, 42 insertions, 0 deletions
diff --git a/hybrid.cgi b/hybrid.cgi index cf9cc88..8323450 100755 --- a/hybrid.cgi +++ b/hybrid.cgi @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# TODO: Check if file exists + import sys import os import cgi diff --git a/nginx-site.conf b/nginx-site.conf new file mode 100644 index 0000000..6ee22ed --- /dev/null +++ b/nginx-site.conf @@ -0,0 +1,40 @@ +server { + server_name runxiyu.org; + root /var/www/root; + index index.html; + location /hybrid/ { + gzip off; + root /var/www/root; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /var/www/root/hybrid.cgi; + fastcgi_param PATH_INFO $uri; + fastcgi_param SERVER_NAME $host; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + } + location / { + try_files $uri $uri/ =404; + } + location ~ ^/.*\.cgi$ { + gzip off; + root /var/www/root; + include fastcgi_params; + fastcgi_param PATH_INFO $uri; + fastcgi_param SERVER_NAME $host; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + } + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/runxiyu.org/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/runxiyu.org/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot +} +server { + if ($host = runxiyu.org) { + return 301 https://$host$request_uri; + } # managed by Certbot + server_name runxiyu.org; + listen 80; + listen [::]:80; + return 404; # managed by Certbot +} |