ericharth

domain.conf (Web server)

Jan 7th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. server {
  2. listen 80;
  3. server_name www.domain.co.uk m.domain.co.uk domain.static.co.uk;
  4.  
  5. charset utf-8;
  6.  
  7. access_log /var/log/nginx/domain-main/domain-main.access.log main;
  8. error_log /var/log/nginx/domain-main/domain-main.error.log notice;
  9.  
  10. root /var/www/html/domain_main;
  11. location / {
  12. index index.php index.html index.htm;
  13. try_files $uri $uri/ /index.php?$args;
  14. client_max_body_size 20M;
  15. }
  16.  
  17. error_page 404 /404.html;
  18. location = /404.html {
  19. root /usr/share/nginx/html;
  20. }
  21.  
  22. # redirect server error pages to the static page /50x.html
  23. #
  24. error_page 500 502 503 504 /500.php;
  25. location = /50x.html {
  26. root /usr/share/nginx/html;
  27. }
  28.  
  29. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  30. #
  31. location ~ \.php$ {
  32. fastcgi_pass 127.0.0.1:9000;
  33. fastcgi_index index.php;
  34. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  35. include fastcgi_params;
  36. }
  37.  
  38. # set expires headers for images and serve blank gif for 404s
  39. location ~* \.(jpeg|jpg|gif|png|ico)$ {
  40. log_not_found off;
  41. expires 2d;
  42. error_page 404 /404-image.gif;
  43. }
  44. location /404-image.gif {
  45. root /usr/share/nginx/html;
  46. }
  47.  
  48. location ~* \.(js|css)$ {
  49. #set 2 day cache time for static assets
  50. expires 2d;
  51. log_not_found off;
  52. }
  53.  
  54. # deny access to .htaccess files, if Apache's document root
  55. # concurs with nginx's one
  56. #
  57. location ~ /\.ht {
  58. deny all;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment