Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- server_name wiki.xyz.de;
- root /var/www/mediawiki-1.34.0;
- client_max_body_size 5m;
- client_body_timeout 60;
- # Location for wiki's entry points
- location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
- try_files $uri $uri/ =404;
- include /etc/nginx/fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
- fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # or whatever port your PHP-FPM listens on
- }
- # Images
- location /images {
- # Separate location for images/ so .php execution won't apply
- }
- location /images/deleted {
- # Deny access to deleted images folder
- deny all;
- }
- # MediaWiki assets (usually images)
- location ~ ^/resources/(assets|lib|src) {
- try_files $uri 404;
- add_header Cache-Control "public";
- expires 7d;
- }
- # Assets, scripts and styles from skins and extensions
- location ~ ^/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg)$ {
- try_files $uri 404;
- add_header Cache-Control "public";
- expires 7d;
- }
- ## Uncomment the following code if you wish to use the installer/updater
- ## installer/updater
- #location /mw-config/ {
- # # Do this inside of a location so it can be negated
- # location ~ \.php$ {
- # include /etc/nginx/fastcgi_params;
- # fastcgi_param SCRIPT_FILENAME $document_root/mw-config/$fastcgi_script_name;
- # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # or whatever port your PHP-FPM listens on
- # }
- #}
- # Handling for the article path (pretty URLs)
- location / {
- rewrite ^/(?<pagename>.*)$ /index.php;
- include fastcgi_params;
- # article path should always be passed to index.php
- fastcgi_param SCRIPT_FILENAME $document_root/index.php;
- fastcgi_param PATH_INFO $pagename;
- fastcgi_param QUERY_STRING $query_string;
- fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # or whatever port your PHP-FPM listens on
- }
- # Allow robots.txt in case you have one
- location = /robots.txt {
- }
- # Explicit access to the root website, redirect to main page (adapt as needed)
- #location = / {
- # return 301 https://wiki.xyz.de/Hauptseite;
- #}
- # Every other entry point will be disallowed.
- # Add specific rules for other entry points/images as needed above this
- #location / {
- # return 404;
- #}
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_certificate /etc/ssl/certs/wiki.xyz.de.fullchain.pem;
- ssl_certificate_key /etc/ssl/private/wiki.xyz.de.private.pem;
- }
- server {
- if ($host = wiki.xyz.de){
- return 301 https://$host$request_uri;
- }
- listen 80;
- listen [::]:80;
- server_name wiki.xyz.de;
- return 404;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement