Fix escapes in nginx config output

This commit is contained in:
2025-08-21 19:45:18 +00:00
parent a3e03c2bef
commit 76c88940de

View File

@ -204,41 +204,35 @@ server {
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
# Redirect root to Main_Page (pretty URL)
location = / { location = / {
return 302 /wiki/Main_Page; return 302 /wiki/Main_Page;
} }
# Pretty URL support: /wiki/Title
location /wiki/ { location /wiki/ {
try_files $uri $uri/ @rewrite; try_files \$uri \$uri/ @rewrite;
} }
location @rewrite { location @rewrite {
rewrite ^/wiki/(.*)$ /index.php?title=$1&$args; rewrite ^/wiki/(.*)\$ /index.php?title=\$1&\$args;
} }
# Block direct access to maintenance scripts
location ^~ /maintenance/ { location ^~ /maintenance/ {
return 403; return 403;
} }
# Handle PHP files location ~ \.php\$ {
location ~ \.php$ {
include snippets/fastcgi-php.conf; include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock; fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params; include fastcgi_params;
} }
# Static content caching location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|ttf|woff|woff2)\$ {
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|ttf|woff|woff2)$ { try_files \$uri /index.php;
try_files $uri /index.php;
expires max; expires max;
log_not_found off; log_not_found off;
} }
# Redirect /activate to /activate/
location = /activate { location = /activate {
return 301 /activate/; return 301 /activate/;
} }
@ -248,7 +242,7 @@ server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server; listen [::]:80 default_server;
server_name _; server_name _;
return 301 https://$host$request_uri; return 301 https://\$host\$request_uri;
} }
EOF EOF