dandv

nginx configuration for Wordpress

Oct 12th, 2014
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.92 KB | None | 0 0
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # http://wiki.nginx.org/Pitfalls
  5. # http://wiki.nginx.org/QuickStart
  6. # http://wiki.nginx.org/Configuration
  7.  
  8. server {
  9.     server_name www.blueseed.co;
  10.     return 301 $scheme://blueseed.com$request_uri;
  11. }
  12.  
  13. map $uri $uri_no_dot_html {
  14.     default $uri;
  15.  
  16.     /faq.html /faq/;
  17.     /quick-facts.html /quick-facts/;
  18.     /about-us.html /about-us/;
  19.     /start-up-survey /come-aboard/;  # Added 2012-09-24
  20.     /start-up-survey/ /come-aboard/;  # Added 2012-09-24
  21.     /startup-survey /come-aboard/;  # doesn't match '/startup-survey/'. Added 2012-09-17
  22.     /startup-survey/ /come-aboard/;  # also catches /startup-survey/results. Added 2012-09-17
  23. }
  24.  
  25. server {
  26.     server_name blueseed.com bluesee.com;
  27.  
  28.         # do faq.html & co. maps - http://wiki.nginx.org/HttpMapModule
  29.     if ($uri_no_dot_html != $uri) {
  30.         rewrite ^ $uri_no_dot_html permanent;
  31.     }
  32.  
  33.     root /var/www/blueseed-wp;
  34.  
  35.     access_log /var/www/blueseed-wp/logs/access.log;
  36.     error_log  /var/www/blueseed-wp/logs/error.log error;
  37.  
  38.     location / {
  39.         # First attempt to serve request as file, then as directory, then fall back to index.html
  40.         try_files $uri $uri/ /index.php?$args;
  41.         index index.php;
  42.     }
  43.  
  44.         # deny access to hidden files
  45.     location ~ /\. {
  46.         access_log off;
  47.         log_not_found off;
  48.         deny all;
  49.     }
  50.  
  51.         # cache image files
  52.     location ~* \.(jpe?g|gif|png|css|js|ico)$ {
  53.         access_log        off;
  54.         expires           1w;
  55.     }
  56.  
  57.     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  58.     #
  59.     location ~ \.php$ {
  60.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  61.     #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  62.     #
  63.     #   # With php5-cgi alone:
  64.         fastcgi_pass 127.0.0.1:9000;
  65.     #   # With php5-fpm:
  66.     #   fastcgi_pass unix:/var/run/php5-fpm.sock;
  67.         fastcgi_index index.php;
  68.         include fastcgi_params;
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment