Advertisement
Guest User

default

a guest
Nov 9th, 2016
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.09 KB | None | 0 0
  1. # You may add here your
  2. # server {
  3. # ...
  4. # }
  5. # statements for each of your virtual hosts to this file
  6.  
  7. ##
  8. # You should look at the following URL's in order to grasp a solid understanding
  9. # of Nginx configuration files in order to fully unleash the power of Nginx.
  10. # http:// wiki.nginx.org/Pitfalls
  11. # http:// wiki.nginx.org/QuickStart
  12. # http:// wiki.nginx.org/Configuration
  13. #
  14. # Generally, you will want to move this file somewhere, and start with a clean
  15. # file but keep this around for reference. Or just disable in sites-enabled.
  16. #
  17. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  18. ##
  19.  
  20. server {
  21. listen [::]:80;
  22. server_name www.mydomain.com
  23. rewrite ^ http:// mydomain.com$request_uri? permanent;
  24. }
  25.  
  26. server {
  27. listen 80 default_server;
  28. listen [::]:80 default_server ipv6only=on;
  29.  
  30. root /usr/share/nginx/html;
  31. index index.php index.html index.htm;
  32.  
  33. # Make site accessible from http:// localhost/
  34. server_name localhost;
  35.  
  36. location / {
  37. # First attempt to serve request as file, then
  38. # as directory, then fall back to displaying a 404.
  39. try_files $uri $uri/ =404;
  40. # Uncomment to enable naxsi on this location
  41. # include /etc/nginx/naxsi.rules
  42. }
  43.  
  44. location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|store) {
  45. deny all;
  46. return 403;
  47. }
  48.  
  49. location ~* \.(gif|jpe?g|png|css)$ {
  50. expires 30d;
  51. }
  52.  
  53. location ~ \.php$ {
  54. try_files $uri =404;
  55. fastcgi_pass unix:/tmp/php.socket;
  56. fastcgi_index index.php;
  57. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  58. include fastcgi_params;
  59. }
  60.  
  61.  
  62. # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  63. #location /RequestDenied {
  64. # proxy_pass http:// 127.0.0.1:8080;
  65. #}
  66.  
  67. #error_page 404 /404.html;
  68.  
  69. # redirect server error pages to the static page /50x.html
  70. #
  71. #error_page 500 502 503 504 /50x.html;
  72. #location = /50x.html {
  73. # root /usr/share/nginx/html;
  74. #}
  75.  
  76. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  77. #
  78. #location ~ \.php$ {
  79. # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  80. # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  81. #
  82. # # With php5-cgi alone:
  83. # fastcgi_pass 127.0.0.1:9000;
  84. # # With php5-fpm:
  85. # fastcgi_pass unix:/var/run/php5-fpm.sock;
  86. # fastcgi_index index.php;
  87. # include fastcgi_params;
  88. #}
  89.  
  90. # deny access to .htaccess files, if Apache's document root
  91. # concurs with nginx's one
  92. #
  93. #location ~ /\.ht {
  94. # deny all;
  95. #}
  96. }
  97.  
  98.  
  99. # another virtual host using mix of IP-, name-, and port-based configuration
  100. #
  101. #server {
  102. # listen 8000;
  103. # listen somename:8080;
  104. # server_name somename alias another.alias;
  105. # root html;
  106. # index index.html index.htm;
  107. #
  108. # location / {
  109. # try_files $uri $uri/ =404;
  110. # }
  111. #}
  112.  
  113.  
  114. # HTTPS server
  115. #
  116. #server {
  117. # listen 443;
  118. # server_name localhost;
  119. #
  120. # root html;
  121. # index index.html index.htm;
  122. #
  123. # ssl on;
  124. # ssl_certificate cert.pem;
  125. # ssl_certificate_key cert.key;
  126. #
  127. # ssl_session_timeout 5m;
  128. #
  129. # ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  130. # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
  131. # ssl_prefer_server_ciphers on;
  132. #
  133. # location / {
  134. # try_files $uri $uri/ =404;
  135. # }
  136. #}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement