Advertisement
matriphe

Nginx config for Wordpress single site

Jan 25th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. server {
  2. listen 80;
  3. server_name your.domain.name;
  4.  
  5. #charset koi8-r;
  6.  
  7. access_log /path/to/log/access.log main;
  8. error_log /path/to/error/log/error.log;
  9.  
  10. root /path/to/directory/root;
  11. index index.php index.html;
  12.  
  13. location / {
  14. try_files $uri $uri/ /index.php;
  15.  
  16. if (-e $request_filename) {
  17. break;
  18. }
  19.  
  20. if (!-e $request_filename) {
  21. rewrite ^(.*)$ /index.php?q=$1 last;
  22. }
  23. }
  24.  
  25. error_page 404 /404.html;
  26. location = /404.html {
  27. root /usr/share/nginx/html;
  28. }
  29.  
  30. error_page 500 502 503 504 /50x.html;
  31. location = /50x.html {
  32. root /usr/share/nginx/html;
  33. }
  34.  
  35. location ~ \.php$ {
  36. #root html;
  37. fastcgi_pass 127.0.0.1:9000;
  38. fastcgi_index index.php;
  39. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  40. include fastcgi_params;
  41. }
  42.  
  43. location ~ /\.ht {
  44. deny all;
  45. }
  46.  
  47. location /favicon.ico { access_log off; error_log off; }
  48. location /robots.txt { access_log off; error_log off; }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement