Advertisement
keha76

nginx_server_demo_setup

Feb 8th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.68 KB | None | 0 0
  1. server {
  2.     listen 80;
  3.  
  4.     server_name domainname.com *.domainname.com;
  5.  
  6.     index index.php;
  7.     root /www/domainname/public;
  8.  
  9.     # Logging
  10.     access_log  off;
  11.  
  12.     location / {
  13.         try_files $uri $uri/ /index.php?$args;
  14.     }
  15.    
  16.     location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
  17.         expires 30d;
  18.         add_header Pragma public;
  19.         add_header Cache-Control "public";
  20.     }
  21.  
  22.     location ~ \.php$ {
  23.        
  24.         location ~ /wp-(admin|login) {
  25.             return 301 https://$host/wp-admin/;
  26.         }
  27.  
  28.         try_files $uri =404;
  29.         include fastcgi_params;
  30.         fastcgi_pass unix:/var/run/php5-fpm.sock;
  31.     }
  32.  
  33.     # Leverage Browser Caching
  34.     location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
  35.         expires 1y;
  36.         log_not_found off;
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement