Created
July 9, 2012 02:13
-
-
Save kubosho/3073839 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
user www-data; | |
worker_processes 3; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
## | |
# Basic Settings | |
## | |
sendfile on; | |
server_tokens off; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 3; | |
types_hash_max_size 2048; | |
include /etc/nginx/mime.types; | |
index index.php index.html index.htm; | |
default_type application/octet-stream; | |
## | |
# Logging Settings | |
## | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
## | |
# Gzip Settings | |
## | |
gzip on; | |
gzip_disable "msie6"; | |
## | |
# Virtual Host Configs | |
## | |
include /etc/nginx/sites-enabled/*; | |
## | |
# Limit upload size | |
## | |
client_max_body_size 10M; | |
## | |
# Proxy Settings | |
## | |
proxy_cache_path /home/hoge/www/nginx_cache levels=1:2 keys_zone=czone:4m max_size=50m inactive=120m; | |
proxy_temp_path /home/hoge/www/nginx_tmp; | |
## | |
# Server Settings | |
## | |
upstream backend { | |
ip_hash; | |
server 127.0.0.1:8080; | |
} | |
server { | |
listen 8080; | |
server_name _; | |
location /wordpress/wp-admin { | |
proxy_pass http://backend; | |
} | |
location /wordpress/wp-login.php { | |
proxy_pass http://backend; | |
} | |
location / { | |
# static files | |
if (-f $request_filename) { | |
expires 30d; | |
break; | |
} | |
# request to index.php | |
if (!-e $request_filename) { | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) { | |
set $do_not_cache 1; | |
} | |
if ($http_user_agent ~* “2.0\ 2MMP|240×320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo\ Wii|Nitro|Nokia|Opera\ Mini|Palm|PlayStation\ Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian\ OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows\ CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915\ Obigo|LGE\ VX|webOS|Nokia5800″) { | |
set $do_not_cache 1; | |
} | |
proxy_no_cache $do_not_cache; | |
proxy_cache_bypass $do_not_cache; | |
proxy_pass http://backend; | |
proxy_cache czone; | |
proxy_cache_key $scheme$proxy_host$uri$is_args$args; | |
proxy_cache_valid 200 10m; | |
} | |
} | |
## | |
# PHP | |
## | |
upstream php { | |
server unix:/tmp/php-fpm.sock; | |
server 127.0.0.1:9000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment