Create a gist now

Instantly share code, notes, and snippets.

upstream backend {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name _;
#access_log /var/log/nginx/access_80.log main;
access_log /var/log/nginx/access_80.log;
location = /favicon.ico {
log_not_found off;
}
location /wp-admin {
proxy_pass http://backend;
}
location /wp-login.php {
proxy_pass http://backend;
}
#location = / {
# rewrite ^(.+)$ /index.php;
#}
location = /wp-admin {
rewrite ^(.+)$ /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 _;
#access_log /var/log/nginx/access_8080.log main;
access_log /var/log/nginx/access_8080.log ;
#location / {
# root /usr/share/nginx/html;
# index index.php index.html index.htm;
#}
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
# include fastcgi_params;
# fastcgi_pass_header "X-Accel-Redirect";
# fastcgi_pass_header "X-Accel-Expires";
#}
root /var/www;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name yapani.com;
include hhvm.conf;
if (!-e $request_filename) {
rewrite ^.+?($/-.*) $1 last;
rewrite ^.+?(/.*\.php)$ $1 last;
rewrite ^ /index.php last;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment