Advertisement
Guest User

www.example.com.vhost

a guest
Aug 9th, 2014
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. server {
  2. listen 80;
  3. listen 443 ssl;
  4. server_name example.com;
  5. ssl_certificate /etc/nginx/ssl/nginx.crt;
  6. ssl_certificate_key /etc/nginx/ssl/nginx.key;
  7. return 301 $scheme://www.example.com$request_uri;
  8. }
  9. server {
  10. listen 80;
  11. server_name www.example.com;
  12. return 301 https://www.example.com$request_uri;
  13. }
  14. server {
  15. listen 443 ssl;
  16. server_name www.example.com;
  17. ssl_certificate /etc/nginx/ssl/nginx.crt;
  18. ssl_certificate_key /etc/nginx/ssl/nginx.crt;
  19. root /var/www; ## <-- Your only path reference.
  20.  
  21. # Enable compression, this will help if you have for instance advagg‎ module
  22. # by serving Gzip versions of the files.
  23. gzip_static on;
  24.  
  25.  
  26. location = /favicon.ico {
  27. log_not_found off;
  28. access_log off;
  29. }
  30.  
  31. location = /robots.txt {
  32. allow all;
  33. log_not_found off;
  34. access_log off;
  35. }
  36.  
  37. # This matters if you use drush prior to 5.x
  38. # After 5.x backups are stored outside the Drupal install.
  39. #location = /backup {
  40. # deny all;
  41. #}
  42. # Very rarely should these ever be accessed outside of your lan
  43. location ~* \.(txt|log)$ {
  44. allow 192.168.0.0/16;
  45. deny all;
  46. }
  47.  
  48. location ~ \..*/.*\.php$ {
  49. return 403;
  50. }
  51.  
  52. # No no for private
  53. location ~ ^/sites/.*/private/ {
  54. return 403;
  55. }
  56.  
  57. # Block access to "hidden" files and directories whose names begin with a
  58. # period. This includes directories used by version control systems such
  59. # as Subversion or Git to store control files.
  60. location ~ (^|/)\. {
  61. return 403;
  62. }
  63.  
  64. location / {
  65. # This is cool because no php is touched for static content
  66. try_files $uri @rewrite;
  67. }
  68.  
  69. location @rewrite {
  70. # You have 2 options here
  71. # For D7 and above:
  72. # Clean URLs are handled in drupal_environment_initialize().
  73. rewrite ^ /index.php;
  74. # For Drupal 6 and bwlow:
  75. # Some modules enforce no slash (/) at the end of the URL
  76. # Else this rewrite block wouldn't be needed (GlobalRedirect)
  77. #rewrite ^/(.*)$ /index.php?q=$1;
  78. }
  79.  
  80. location ~ \.php$ {
  81. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  82. #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  83. include fastcgi_params;
  84. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  85. fastcgi_intercept_errors on;
  86. fastcgi_pass 127.0.0.1:9000;
  87. }
  88.  
  89. # Fighting with Styles? This little gem is amazing.
  90. # This is for D6
  91. #location ~ ^/sites/.*/files/imagecache/ {
  92. # This is for D7 and D8
  93. location ~ ^/sites/.*/files/styles/ {
  94. try_files $uri @rewrite;
  95. }
  96.  
  97. location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  98. expires max;
  99. log_not_found off;
  100. }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement