Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- location / {
- index index.php;
- try_files $uri $uri/ @mediawiki;
- }
- location @mediawiki {
- rewrite ^/(.*)$ /index.php;
- }
- location ~ \.php5?$ {
- include /etc/nginx/fastcgi_params;
- fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
- fastcgi_index index.php5;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- try_files $uri @mediawiki;
- }
- location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
- try_files $uri /index.php;
- expires max;
- log_not_found off;
- }
- # Restrictions based on the .htaccess files
- location ^~ ^/(cache|includes|maintenance|languages|serialized|tests|images/deleted)/ {
- deny all;
- }
- location ^~ ^/(bin|docs|extensions|includes|maintenance|mw-config|resources|serialized|tests)/ {
- internal;
- }
- location ^~ /images/ {
- try_files $uri /index.php;
- }
- location ~ /\. {
- access_log off;
- log_not_found off;
- deny all;
- }
- # Location for wiki's entry points
- location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
- include /etc/nginx/fastcgi_params;
- fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
- fastcgi_pass 127.0.0.1:9000; # 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;
- }
- # Favicon
- #location = /favicon.ico {
- # alias /images/6/64/Favicon.ico;
- # add_header Cache-Control "public";
- # expires 7d;
- #}
- # Uncomment the following code if you wish to use the installer/updater
- # installer/updater
- #location /w/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/w/mw-config/$fastcgi_script_name;
- # fastcgi_pass 127.0.0.1:9000; # or whatever port your PHP-FPM listens on
- # }
- #}
- #
- ## Handling for the article path (pretty URLs)
- #location /wiki/ {
- # rewrite ^/wiki/(?<pagename>.*)$ /w/index.php;
- # include /etc/nginx/fastcgi_params;
- # # article path should always be passed to index.php
- # fastcgi_param SCRIPT_FILENAME $document_root/w/index.php;
- # fastcgi_param PATH_INFO $pagename;
- # fastcgi_param QUERY_STRING $query_string;
- # fastcgi_pass 127.0.0.1:9000; # 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://www.example.com/wiki/Main_page;
- #}
- #
- ## Every other entry point will be disallowed.
- ## Add specific rules for other entry points/images as needed above this
- #location / {
- # return 404;
- #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement