Skip to content

Instantly share code, notes, and snippets.

@camsong
Created September 9, 2012 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save camsong/3682907 to your computer and use it in GitHub Desktop.
Save camsong/3682907 to your computer and use it in GitHub Desktop.
Sample of nginx config for php wordpress sites
server {
listen 80;
server_name rubyer.me www.rubyer.me;
root /home/sites/rubyer.me/;
index index.php index.html index.htm;
#add for wordpress permentlink
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
#####################
location / {
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm-www-data.sock;
include fastcgi_params;
}
## Disable viewing .htaccess & .htpassword
location ~ /\.ht {
deny all;
}
## Enable cache for assets
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment