Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.08 KB | None | 0 0
  1. location / {
  2.    index index.php;
  3.    try_files $uri $uri/ @mediawiki;
  4. }
  5. location @mediawiki {
  6.    rewrite ^/(.*)$ /index.php;
  7. }
  8. location ~ \.php5?$ {
  9.    include /etc/nginx/fastcgi_params;
  10.    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
  11.    fastcgi_index index.php5;
  12.    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  13.    try_files $uri @mediawiki;
  14. }
  15. location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  16.    try_files $uri /index.php;
  17.    expires max;
  18.    log_not_found off;
  19. }
  20. # Restrictions based on the .htaccess files
  21. location ^~ ^/(cache|includes|maintenance|languages|serialized|tests|images/deleted)/ {
  22.    deny all;
  23. }
  24. location ^~ ^/(bin|docs|extensions|includes|maintenance|mw-config|resources|serialized|tests)/ {
  25.    internal;
  26. }
  27. location ^~ /images/ {
  28.    try_files $uri /index.php;
  29. }
  30. location ~ /\. {
  31.    access_log off;
  32.    log_not_found off;
  33.    deny all;
  34. }
  35. # Location for wiki's entry points
  36. location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
  37.    include /etc/nginx/fastcgi_params;
  38.    fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
  39.    fastcgi_pass 127.0.0.1:9000; # or whatever port your PHP-FPM listens on
  40. }
  41.  
  42. ## Images
  43. #location /images {
  44. #   # Separate location for images/ so .php execution won't apply
  45. #}
  46. #location /images/deleted {
  47. #   # Deny access to deleted images folder
  48. #   deny all;
  49. #}
  50. ## MediaWiki assets (usually images)
  51. #location ~ ^/resources/(assets|lib|src) {
  52. #   try_files $uri 404;
  53. #   add_header Cache-Control "public";
  54. #   expires 7d;
  55. #}
  56. # Assets, scripts and styles from skins and extensions
  57. location ~ ^/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg)$ {
  58.    try_files $uri 404;
  59.    add_header Cache-Control "public";
  60.    expires 7d;
  61. }
  62. # Favicon
  63. #location = /favicon.ico {
  64. #   alias /images/6/64/Favicon.ico;
  65. #   add_header Cache-Control "public";
  66. #   expires 7d;
  67. #}
  68.  
  69. # Uncomment the following code if you wish to use the installer/updater
  70. # installer/updater
  71. #location /w/mw-config/ {
  72. #   # Do this inside of a location so it can be negated
  73. #   location ~ \.php$ {
  74. #       include /etc/nginx/fastcgi_params;
  75. #       fastcgi_param SCRIPT_FILENAME $document_root/w/mw-config/$fastcgi_script_name;
  76. #       fastcgi_pass 127.0.0.1:9000; # or whatever port your PHP-FPM listens on
  77. #   }
  78. #}
  79. #
  80. ## Handling for the article path (pretty URLs)
  81. #location /wiki/ {
  82. #   rewrite ^/wiki/(?<pagename>.*)$ /w/index.php;
  83. #   include /etc/nginx/fastcgi_params;
  84. #   # article path should always be passed to index.php
  85. #   fastcgi_param SCRIPT_FILENAME   $document_root/w/index.php;
  86. #   fastcgi_param PATH_INFO $pagename;
  87. #   fastcgi_param QUERY_STRING $query_string;
  88. #   fastcgi_pass  127.0.0.1:9000; # or whatever port your PHP-FPM listens on
  89. #}
  90. #
  91. ## Allow robots.txt in case you have one
  92. #location = /robots.txt {
  93. #}
  94. ## Explicit access to the root website, redirect to main page (adapt as needed)
  95. #location = / {
  96. #   return 301 https://www.example.com/wiki/Main_page;
  97. #}
  98. #
  99. ## Every other entry point will be disallowed.
  100. ## Add specific rules for other entry points/images as needed above this
  101. #location / {
  102. #   return 404;
  103. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement