Created
September 9, 2012 06:14
-
-
Save camsong/3682907 to your computer and use it in GitHub Desktop.
Sample of nginx config for php wordpress sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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