Advertisement
rockdrilla

nginx config for rajonich; sorry, may not work at all :]

Nov 11th, 2013
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. server {
  2. listen 80 default;
  3. server_name localhost '' ' ' 192.168.1.120;
  4.  
  5. ##### http://nginx.org/en/docs/http/configuring_https_servers.html
  6. # listen 443 ssl default_server;
  7. # ssl_certificate server.full_chain.crt;
  8. # ssl_certificate_key server.key;
  9. # ssl_ciphers RC4:HIGH:!aNULL:!MD5;
  10. # ssl_prefer_server_ciphers on;
  11.  
  12. root /var/www/owncloud;
  13.  
  14. client_max_body_size 10G;
  15. fastcgi_buffers 64 4K;
  16.  
  17. index index.php index.php5 index.html index.htm;
  18.  
  19. #<tweaks>
  20. location ~ /\. { access_log off; log_not_found off; deny all; }
  21. location ~ ~$ { access_log off; log_not_found off; deny all; }
  22. location = /robots.txt { access_log off; log_not_found off; }
  23. location = /favicon.ico { access_log off; log_not_found off; }
  24. location ~ /_\.gif$ {
  25. log_not_found off;
  26. expires max;
  27. access_log off;
  28. empty_gif;
  29. }
  30. location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|htm|bmp|tiff|tif|pdf|swf)$ {
  31. access_log off;
  32. log_not_found off;
  33. expires max;
  34. }
  35. #</tweaks>
  36.  
  37.  
  38. #<pwncloud>
  39. rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
  40. rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
  41. rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  42.  
  43. location / {
  44. rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  45. rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
  46.  
  47. rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
  48. rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
  49.  
  50. rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  51.  
  52. error_page 403 = /core/templates/403.php;
  53. error_page 404 = /core/templates/404.php;
  54.  
  55. try_files $uri $uri/ index.php;
  56. }
  57.  
  58. location ~ ^/(data|config|db_structure\.xml|README) {
  59. internal;
  60. access_log off;
  61. }
  62. #</pwncloud>
  63.  
  64.  
  65. #<mediawiki>
  66. rewrite ^/w/index.php/(.*) /w/$1 permanent;
  67.  
  68. location /w {
  69. alias /var/www/mediawiki;
  70.  
  71. client_max_body_size 5m;
  72. client_body_timeout 60;
  73.  
  74. try_files $uri $uri/ @rewrite_wiki;
  75. }
  76.  
  77. location @rewrite_wiki {
  78. rewrite "^/w/([^?]*)(?:\?(.*))?" /w/index.php?title=$1&$args last;
  79. }
  80.  
  81. location ~ ^/w/images/.*\.(html|htm|shtml|php|php5|sh|py|cgi)$ {
  82. types { }
  83. default_type text/plain;
  84. }
  85.  
  86. location ~ ^/w/(cache|maintenance|mw-config|includes|serialized|languages)((/.*)?)$ {
  87. access_log /var/log/nginx/access.log;
  88. internal;
  89. }
  90.  
  91. location ~* ^/w/.*\.(jpe?g|gif|css|png|js|ico|html|htm|bmp|tiff?|pdf)$ {
  92. try_files $uri /w/index.php;
  93. expires max;
  94. log_not_found off;
  95. }
  96.  
  97. location ~ ^/w/images/ {
  98. try_files $uri /w/index.php;
  99. expires max;
  100. log_not_found off;
  101. }
  102.  
  103. location /w/dumps {
  104. alias /var/www/mediawiki/local;
  105. autoindex on;
  106. }
  107. #</mediawiki>
  108.  
  109.  
  110. #<file.php via PHP-FPM>
  111. location ~ [^/]\.php(/|$) {
  112. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  113. if (!-f $document_root$fastcgi_script_name) { return 404; }
  114. include fastcgi_params;
  115. fastcgi_pass unix:/run/php5-fpm.sock;
  116. fastcgi_index index.php;
  117. }
  118. #</file.php via PHP-FPM>
  119.  
  120.  
  121. #<file.php5 via PHP-FPM>
  122. location ~ [^/]\.php5(/|$) {
  123. fastcgi_split_path_info ^(.+?\.php5)(/.*)$;
  124. if (!-f $document_root$fastcgi_script_name) { return 404; }
  125. include fastcgi_params;
  126. fastcgi_pass unix:/run/php5-fpm.sock;
  127. fastcgi_index index.php5;
  128. }
  129. #</file.php5 via PHP-FPM>
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement