Skip to content

Instantly share code, notes, and snippets.

@t-min
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save t-min/2bc231e0e901e45ba7f7 to your computer and use it in GitHub Desktop.

Select an option

Save t-min/2bc231e0e901e45ba7f7 to your computer and use it in GitHub Desktop.
upstream backend {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name ;localhost
access_log /var/log/nginx/access_80.log main;
location = /favicon.ico {
log_not_found off;
}
location /wordpress/wp-admin {
proxy_pass http://backend;
}
location /wordpress/wp-login.php {
proxy_pass http://backend;
}
location = /wordpress {
rewrite ^(.+)$ /wordpress/index.php;
}
location = /wordpress/wp-admin {
rewrite ^(.+)$ /wordpress/wp-admin/index.php;
}
location / {
proxy_pass http://backend;
proxy_no_cache $do_not_cache;
proxy_cache_bypass $do_not_cache;
proxy_cache zone1;
proxy_cache_key $scheme$proxy_host$uri$is_args$args;
proxy_cache_valid 200 1d;
if ($http_user_agent ~* '(DoCoMo|UP.Browser|SoftBank|WILLCOM|emobile|iPhone|iPod|Android.*Mobile)') {
set $do_not_cache 1;
}
}
}
server {
listen 8080;
server_name localhost;
access_log /var/log/nginx/access_8080.log main;
location / {
root /var/www;
index index.php index.html index.htm;
}
location ~ .php$ {
root html;
fastcgi_pass unix:var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass_header "X-Accel-Redirect";
fastcgi_pass_header "X-Accel-Expires";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment