reorder common/website.conf

This commit is contained in:
root 2022-12-13 09:33:39 +00:00
parent ab8d30c67d
commit 8339b71921
1 changed files with 79 additions and 92 deletions

View File

@ -15,41 +15,25 @@ gzip_types text/plain text/css application/json application/javascript text/xml
error_log /var/log/nginx/error.log;
location /media {
alias /var/www/website/media;
}
location /blog {
alias /var/www/website/blog;
try_files $uri $uri/index.html $uri.html $uri/ @extensionless-php;
index index.html;
}
location /canaries {
alias /var/log/canary;
}
location /gnuplot {
alias /opt/gnuplot;
}
location /style.css {
alias /var/www/website/style.css;
}
location /LICENSE.txt {
alias /var/www/website/LICENSE.txt;
}
location /tmate.conf {
alias /var/www/website/tmate.conf;
default_type text/plain;
}
location /.tmate.conf {
default_type text/plain;
alias /var/www/website/tmate.conf;
# CGI
location ~ \.php$ {
try_files $uri =404;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include snippets/fastcgi.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua|\/cgi-bin)$ {
gzip off;
fastcgi_pass unix:/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
# Main
location / {
if ( -d /var/www/website/$lang) {
rewrite .* /$lang$uri;
@ -69,11 +53,7 @@ location /en {
error_page 404 /en/errors/404;
error_page 503 /en/errors/503;
}
location ~ (\.cgi|\.py|\.sh|\.pl|\.lua|\/cgi-bin)$ {
gzip off;
fastcgi_pass unix:/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
location /pt-BR {
try_files $uri $uri/index.html $uri.html $uri/ @extensionless-php;
error_page 403 /pt-BR/errors/403;
@ -81,6 +61,36 @@ location /pt-BR {
error_page 503 /pt-BR/errors/503;
}
location /blog {
alias /var/www/website/blog;
try_files $uri $uri/index.html $uri.html $uri/ @extensionless-php;
index index.html;
}
location /sitemap {
root /sshfs/websiteupdate/website;
try_files $uri $uri.html $uri/ @extensionless-php;
index off;
ssi on;
fancyindex on;
fancyindex_exact_size off;
fancyindex_default_sort date_desc;
fancyindex_time_format "%a, %e %B %Y %I:%M:%S %p";
subs_filter "<style type=\"text/css\">" "";
subs_filter "</syle>" "";
subs_filter "body,html {background:#fff;font-family:\"Bitstream Vera Sans\",\"Lucida Grande\",\"Lucida Sans Unicode\",Lucidux,Verdana,Lucida,sans-serif;}tr:nth-child(even) {background:#f4f4f4;}th,td {padding:0.1em 0.5em;}th {text-align:left;font-weight:bold;background:#eee;border-bottom:1px solid #aaa;}#list {border:1px solid #aaa;width:100%;}a {color:#a33;}a:hover {color:#e33;}" "<!--#include file=\"/nav\"-->";
subs_filter "/sitemap/" "/";
error_page 403 /en/errors/403;
error_page 404 /en/errors/404;
error_page 503 /en/errors/503;
}
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/htpasswd;
}
location ~^/[^u~].*\.(jpg|jpeg|png|gif|ico)$ {
expires 30d;
}
@ -89,19 +99,6 @@ location /.*/errors/.* {
internal;
}
location ~ \.php$ {
try_files $uri =404;
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include snippets/fastcgi.conf;
fastcgi_pass unix:/run/php/php8.0-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location ~ ^(/media/|/canaries/|/finreport/|/en/finreport/)$ {
fancyindex on;
fancyindex_exact_size off;
@ -109,6 +106,37 @@ location ~ ^(/media/|/canaries/|/finreport/|/en/finreport/)$ {
fancyindex_time_format "%a, %e %B %Y %I:%M:%S %p";
}
# aliases
location /canaries {
alias /var/log/canary;
}
location /media {
alias /var/www/website/media;
}
location /gnuplot {
alias /opt/gnuplot;
}
location /style.css {
alias /var/www/website/style.css;
}
location /LICENSE.txt {
alias /var/www/website/LICENSE.txt;
}
location /tmate.conf {
alias /var/www/website/tmate.conf;
default_type text/plain;
}
location /.tmate.conf {
default_type text/plain;
alias /var/www/website/tmate.conf;
}
location ~ ^/p/(?<user>[\w-]+).asc?$ {
alias /sshfs/home/$user/.pgp.asc;
default_type text/plain;
}
location ~ ^/p/(?<user>[\w-]+).gpg?$ {
alias /sshfs/home/$user/.pgp.gpg;
}
## users
location ~ ^/(~|u/)(?<user>[\w-]+)(?<user_uri>/.*)?$ {
error_log /var/log/nginx/vern.cc-error.log crit;
@ -144,44 +172,3 @@ location ~ ^/(~|u/)(?<user>[\w-]+)(?<user_uri>/.*)?$ {
}
}
location ~ ^/(wp-(admin|login\.php|config\.php)|\.env)$ {
return 301 http://fsn.icmp.hetzner.com/10GB.bin;
}
location /.git {
return 301 http://fsn.icmp.hetzner.com/10GB.bin;
}
location /blog/.git {
return 301 http://fsn.icmp.hetzner.com/10GB.bin;
}
location /sitemap {
root /sshfs/websiteupdate/website;
try_files $uri $uri.html $uri/ @extensionless-php;
index off;
ssi on;
fancyindex on;
fancyindex_exact_size off;
fancyindex_default_sort date_desc;
fancyindex_time_format "%a, %e %B %Y %I:%M:%S %p";
subs_filter "<style type=\"text/css\">" "";
subs_filter "</syle>" "";
subs_filter "body,html {background:#fff;font-family:\"Bitstream Vera Sans\",\"Lucida Grande\",\"Lucida Sans Unicode\",Lucidux,Verdana,Lucida,sans-serif;}tr:nth-child(even) {background:#f4f4f4;}th,td {padding:0.1em 0.5em;}th {text-align:left;font-weight:bold;background:#eee;border-bottom:1px solid #aaa;}#list {border:1px solid #aaa;width:100%;}a {color:#a33;}a:hover {color:#e33;}" "<!--#include file=\"/nav\"-->";
subs_filter "/sitemap/" "/";
error_page 403 /en/errors/403;
error_page 404 /en/errors/404;
error_page 503 /en/errors/503;
}
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/htpasswd;
}
location ~ ^/p/(?<user>[\w-]+).asc?$ {
alias /sshfs/home/$user/.pgp.asc;
default_type text/plain;
}
location ~ ^/p/(?<user>[\w-]+).gpg?$ {
alias /sshfs/home/$user/.pgp.gpg;
}