Advertisement
Guest User

Untitled

a guest
Jan 9th, 2013
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. server {
  2. listen 80;
  3. listen 443 ssl;
  4. ssl_certificate /etc/nginx/example.com_cert.pem;
  5. ssl_certificate_key /etc/nginx/example.com_privkey.pem;
  6.  
  7. root /usr/share/nginx/www/example.com;
  8. index index.html index.php;
  9.  
  10. server_name example.com www.example.com;
  11.  
  12. if ($http_host != "www.example.com") {
  13. rewrite ^ $scheme://www.example.com$request_uri permanent;
  14. }
  15.  
  16. location / {
  17. # First attempt to serve request as file, then
  18. # as directory, then fall back to displaying a 404.
  19. try_files $uri $uri/ =404;
  20. # Uncomment to enable naxsi on this location
  21. # include /etc/nginx/naxsi.rules
  22. }
  23.  
  24. # Serve an empty 1x1 gif _OR_ an error 204 (No Content) for favicon.ico
  25. location = /favicon.ico {
  26. #empty_gif;
  27. return 204;
  28. }
  29.  
  30. location ~ \.php$ {
  31. try_files $uri =404;
  32. include /etc/nginx/fastcgi_params;
  33. fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
  34. fastcgi_index index.php;
  35. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  36. }
  37. }
  38.  
  39. server {
  40. listen 80;
  41. listen 443 ssl;
  42. ssl_certificate /etc/nginx/example.com_cert.pem;
  43. ssl_certificate_key /etc/nginx/example.com_privkey.pem;
  44. server_name static.example.com;
  45. root /usr/share/nginx/www/example.com/static;
  46. location / {
  47. if ($request_filename ~ "\.(jpg|jpeg|css|gif|png)$") {
  48. break;
  49. }
  50. return 404;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement