Guest User

nginx-configuration-file-www.mydomaing.com

a guest
Jul 14th, 2011
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. server {
  2.  
  3. listen 80;
  4. server_name mydomain.com *.mydomain.com;
  5. rewrite ^/(.*) http://www.mydomain.com/$1 permanent;
  6. # rewrite ^/([^?]*)(?:\?(.*))? index.php?thumb=$1$2;
  7. }
  8.  
  9.  
  10. server {
  11. listen 80;
  12. # access_log /var/www/mydomain/log/access.log;
  13. error_log /var/www/mydomain/log/error.log notice;
  14. server_name www.mydomain.com;
  15. root /var/www/mydomain/;
  16.  
  17. location / {
  18. index index.php;
  19. try_files $uri $uri/ /index.php?q=$uri&$args;
  20. # if the requested file exists, return it immediately
  21. if (-f $request_filename) {
  22. break;
  23. }
  24.  
  25. # all other requests go to WordPress
  26. if (!-e $request_filename) {
  27. rewrite . /index.php last;
  28. }
  29. }
  30.  
  31. ## Images and static content is treated different
  32. location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
  33. access_log off;
  34. expires 30d;
  35. root /var/www/mydomain/;
  36. }
  37.  
  38.  
  39. ## Parse all .php file in the /var/www directory
  40. location ~ .php$ {
  41. fastcgi_split_path_info ^(.+\.php)(.*)$;
  42. fastcgi_pass backend;
  43. fastcgi_index index.php;
  44. fastcgi_param SCRIPT_FILENAME /var/www/mydomain/$fastcgi_script_name;
  45. include fastcgi_params;
  46. fastcgi_param QUERY_STRING $query_string;
  47. fastcgi_param REQUEST_METHOD $request_method;
  48. fastcgi_param CONTENT_TYPE $content_type;
  49. fastcgi_param CONTENT_LENGTH $content_length;
  50. fastcgi_intercept_errors on;
  51. fastcgi_ignore_client_abort on;
  52. fastcgi_read_timeout 180;
  53.  
  54. }
  55.  
  56.  
  57. ## Disable viewing .htaccess & .htpassword
  58. location ~ /\.ht {
  59. deny all;
  60. }
  61. }
  62.  
  63.  
  64. upstream backend {
  65. server 127.0.0.1:9000;
  66.  
  67. }
Add Comment
Please, Sign In to add comment