Artim

Mediawiki

Mar 16th, 2020
1,246
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. server {
  2.     server_name wiki.xyz.de;
  3.     root /var/www/mediawiki-1.34.0;
  4.  
  5.     client_max_body_size 5m;
  6.     client_body_timeout 60;
  7.  
  8.     # Location for wiki's entry points
  9.     location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
  10.     try_files $uri $uri/ =404;
  11.         include /etc/nginx/fastcgi_params;
  12.         fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
  13.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # or whatever port your PHP-FPM listens on
  14.     }
  15.  
  16.     # Images
  17.     location /images {
  18.         # Separate location for images/ so .php execution won't apply
  19.     }
  20.     location /images/deleted {
  21.         # Deny access to deleted images folder
  22.         deny all;
  23.     }
  24.     # MediaWiki assets (usually images)
  25.     location ~ ^/resources/(assets|lib|src) {
  26.         try_files $uri 404;
  27.         add_header Cache-Control "public";
  28.         expires 7d;
  29.     }
  30.     # Assets, scripts and styles from skins and extensions
  31.     location ~ ^/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg)$ {
  32.         try_files $uri 404;
  33.         add_header Cache-Control "public";
  34.         expires 7d;
  35.     }
  36.  
  37.    
  38.     ## Uncomment the following code if you wish to use the installer/updater
  39.     ## installer/updater
  40.     #location /mw-config/ {
  41.     #   # Do this inside of a location so it can be negated
  42.     #   location ~ \.php$ {
  43.     #       include /etc/nginx/fastcgi_params;
  44.     #       fastcgi_param SCRIPT_FILENAME $document_root/mw-config/$fastcgi_script_name;
  45.     #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # or whatever port your PHP-FPM listens on
  46.     #   }
  47.     #}
  48.    
  49.     # Handling for the article path (pretty URLs)
  50.     location / {
  51.         rewrite ^/(?<pagename>.*)$ /index.php;
  52.         include fastcgi_params;
  53.         # article path should always be passed to index.php
  54.         fastcgi_param SCRIPT_FILENAME $document_root/index.php;
  55.         fastcgi_param PATH_INFO $pagename;
  56.         fastcgi_param QUERY_STRING $query_string;
  57.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # or whatever port your PHP-FPM listens on
  58.     }
  59.     # Allow robots.txt in case you have one
  60.     location = /robots.txt {
  61.     }
  62.     # Explicit access to the root website, redirect to main page (adapt as needed)
  63.     #location = / {
  64.     #    return 301 https://wiki.xyz.de/Hauptseite;
  65.     #}
  66.     # Every other entry point will be disallowed.
  67.     # Add specific rules for other entry points/images as needed above this
  68.     #location / {
  69.     #    return 404;
  70.     #} 
  71.     listen 443 ssl http2;
  72.     listen [::]:443 ssl http2;
  73.     ssl_protocols TLSv1.2 TLSv1.3;
  74.     ssl_certificate /etc/ssl/certs/wiki.xyz.de.fullchain.pem;
  75.     ssl_certificate_key /etc/ssl/private/wiki.xyz.de.private.pem;
  76. }
  77. server {
  78.     if ($host = wiki.xyz.de){
  79.         return 301 https://$host$request_uri;
  80.         }
  81.         listen 80;
  82.         listen [::]:80;
  83.         server_name wiki.xyz.de;
  84.     return 404;
  85. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×