Created
April 14, 2010 14:39
-
-
Save bartek/365879 to your computer and use it in GitHub Desktop.
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
# This configuration assumes you are running some kind of PHP FastCGI daemon to send for processing. | |
# I've commented parts of the file for clarity if someone does not understand what's going on. | |
# Here we simply rewrite the `www` out of the domain name because it's useless in most cases. | |
# Totally optional. | |
server { | |
listen 80; | |
server_name www.example.com; | |
rewrite ^/(.*) http://example.com/$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
# You can put these logs anywhere, I prefer placing them in the domains folder | |
# so the owner can view their logs easily. | |
access_log /home/user/domains/example.com/logs/access.log; | |
error_log /home/user/domains/example.com/logs/error.log warn; | |
location / { | |
# This is the folder where your Wordpress files should be. | |
root /home/user/domains/example.com/public; | |
index index.php; | |
# If the request is a static file, don't rewrite and cache for 30 days. | |
if (-f $request_filename) { | |
expires 30d; | |
break; | |
} | |
# Same goes for physical directories, but no cache here. | |
if (-d $request_filename) { | |
break; | |
} | |
# Anything else we rewrite and send to Wordpress' index.php for processing. | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
# Catch all .php files and send them to our fastcgi process. | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_param SCRIPT_FILENAME /home/user/domains/example.com/public/$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
include /etc/nginx/fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment