Advertisement
Guest User

NGINX

a guest
Oct 17th, 2012
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. server
  2. {
  3. server_name example.com www.example.com;
  4.  
  5. access_log /var/www/example.com/access.log;
  6.  
  7. error_log /var/www/example.com/error.log;
  8.  
  9. root /var/www/example.com/public_html/;
  10.  
  11. index index.php index.html index.htm;
  12.  
  13. # remove www
  14. if ($host ~* ^www\.(.*))
  15. {
  16. set $host_without_www $1;
  17. rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
  18. }
  19. location ~ \.php$
  20. {
  21. try_files = $uri @missing
  22.  
  23. fastcgi_pass 127.0.0.1:9000;
  24. fastcgi_index index.php;
  25. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  26. include fastcgi_params;
  27. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  28. fastcgi_param REQUEST_URI $request_uri;
  29. fastcgi_param DOCUMENT_URI $document_uri;
  30. fastcgi_param DOCUMENT_ROOT $document_root;
  31. fastcgi_param REMOTE_ADDR $remote_addr;
  32. fastcgi_param REMOTE_PORT $remote_port;
  33. fastcgi_param SERVER_ADDR $server_addr;
  34. fastcgi_param SERVER_PORT $server_port;
  35. fastcgi_param SERVER_NAME $server_name;
  36. fastcgi_param QUERY_STRING $query_string;
  37. fastcgi_param REQUEST_METHOD $request_method;
  38. fastcgi_param CONTENT_TYPE $content_type;
  39. fastcgi_param CONTENT_LENGTH $content_length;
  40.  
  41. # prevent php version info
  42. fastcgi_hide_header X-Powered-By;
  43. }
  44.  
  45. location @missing
  46. {
  47. rewrite ^ $scheme://$host/index.php permanent;
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement