Advertisement
Guest User

nginx config fix

a guest
Feb 19th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. ## redirect from http to https
  2. server {
  3. listen 80 default_server;
  4. server_name site.example.com
  5. www.example.com
  6. example.com;
  7. rewrite ^ https://$server_name$request_uri? permanent;
  8.  
  9. }
  10.  
  11.  
  12. ### HTTPS
  13. server {
  14.  
  15. listen 443 ssl default_server;
  16. ssl on;
  17. ssl_certificate /etc/nginx/cert/_.example.com-chained.pem;
  18. ssl_certificate_key /etc/nginx/cert/_.example.com.key.insecure;
  19. ssl_session_timeout 15m;
  20. ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  21. ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
  22. ssl_prefer_server_ciphers on;
  23. allow all;
  24. server_name site.example.com _;
  25. root /usr/share/nginx/www/site.example.com/public_html;
  26. index index.php index.html index.htm;
  27.  
  28. ###################################################
  29. ### this is the configuration that fixed my problem
  30.  
  31. if ($host !~* ^site\.) {
  32. return 301 https://site.example.com$request_uri$is_args$args;
  33. }
  34.  
  35. ###################################################
  36. ###################################################
  37.  
  38. access_log /var/log/nginx/site.example.com.access.log;
  39. error_log /var/log/nginx/site.example.com.error.log debug;
  40.  
  41. ### enable php scripts
  42. location ~ \.php$ {
  43. fastcgi_pass 127.0.0.1:9000;
  44. fastcgi_index index.php;
  45. include fastcgi_params;
  46. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  47. }
  48. ###
  49.  
  50.  
  51. }
  52.  
  53. ### END OF HTTPS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement