Created
January 7, 2011 21:54
-
-
Save scribu/770180 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
# Upstream to abstract backend connection(s) for php | |
upstream php { | |
server unix:/tmp/php-cgi.socket; | |
server 127.0.0.1:9000; | |
} | |
server { | |
server_name example.com; | |
root /var/www; | |
## This should be in your http block and if it is, it's not needed here. | |
index index.php; | |
# bbPress | |
rewrite ^/forum/page/([0-9]+)/?$ /forum/index.php?page=$1 last; | |
rewrite ^/forum/forum/([^/]+)/page/([0-9]+)/?$ /forum/forum.php?id=$1&page=$2 last; | |
rewrite ^/forum/forum/([^/]+)/?$ /forum/forum.php?id=$1 last; | |
rewrite ^/forum/forum/?$ /forum/ permanent; | |
rewrite ^/forum/topic/([^/]+)/page/([0-9]+)/?$ /forum/topic.php?id=$1&page=$2 last; | |
rewrite ^/forum/topic/([^/]+)/?$ /forum/topic.php?id=$1 last; | |
rewrite ^/forum/topic/?$ /forum/ permanent; | |
rewrite ^/forum/tags/([^/]+)/page/([0-9]+)/?$ /forum/tags.php?tag=$1&page=$2 last; | |
rewrite ^/forum/tags/([^/]+)/?$ /forum/tags.php?tag=$1 last; | |
rewrite ^/forum/tags/?$ /forum/tags.php last; | |
rewrite ^/forum/profile/([^/]+)/page/([0-9]+)/?$ /forum/profile.php?id=$1&page=$2 last; | |
rewrite ^/forum/profile/([^/]+)/([^/]+)/?$ /forum/profile.php?id=$1&tab=$2 last; | |
rewrite ^/forum/profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /forum/profile.php?id=$1&tab=$2&page=$3 last; | |
rewrite ^/forum/profile/([^/]+)/?$ /forum/profile.php?id=$1 last; | |
rewrite ^/forum/profile/?$ /forum/profile.php last; | |
rewrite ^/forum/view/([^/]+)/page/([0-9]+)/?$ /forum/view.php?view=$1&page=$2 last; | |
rewrite ^/forum/view/([^/]+)/?$ /forum/view.php?view=$1 last; | |
rewrite ^/forum/rss/?$ /forum/rss.php last; | |
rewrite ^/forum/rss/topics/?$ /forum/rss.php?topics=1 last; | |
rewrite ^/forum/rss/forum/([^/]+)/?$ /forum/rss.php?forum=$1 last; | |
rewrite ^/forum/rss/forum/([^/]+)/topics/?$ /forum/rss.php?forum=$1&topics=1 last; | |
rewrite ^/forum/rss/topic/([^/]+)/?$ /forum/rss.php?topic=$1 last; | |
rewrite ^/forum/rss/tags/([^/]+)/?$ /forum/rss.php?tag=$1 last; | |
rewrite ^/forum/rss/tags/([^/]+)/topics/?$ /forum/rss.php?tag=$1&topics=1 last; | |
rewrite ^/forum/rss/profile/([^/]+)/?$ /forum/rss.php?profile=$1 last; | |
rewrite ^/forum/rss/view/([^/]+)/?$ /forum/rss.php?view=$1 last; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
# This is cool because no php is touched for static content | |
try_files $uri $uri/ /index.php?q=$uri&$args; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
include fastcgi_params; | |
fastcgi_pass php; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment