Forked from jakebellacera/nginx-apache-reverse-proxy-wordpress-mu-vhost.conf
Created
December 17, 2017 15:55
-
-
Save esfand/472ca8efd4de6674fb92df4b2800b17f to your computer and use it in GitHub Desktop.
Useful nginx virtual host configuration for reverse proxy (proxy_pass) with Apache
This file contains hidden or 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
# useful nginx configuration for reverse proxy with Apache | |
# edit lines 8, 11, and 30 | |
# taken from: http://syslog.tv/2010/01/11/debian-apache-2-nginx-wordpress-mu/ | |
# edits by jakebellacera (http://github.com/jakebellacera && http://jakebellacera.com) | |
server { | |
listen 80; | |
server_name domain.com *.domain.com; # edit this to your domain | |
location / { | |
proxy_pass http://domain.com:1111; # set to your own port | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
client_max_body_size 10m; | |
client_body_buffer_size 128k; | |
proxy_connect_timeout 90; | |
proxy_send_timeout 90; | |
proxy_read_timeout 90; | |
proxy_buffer_size 4k; | |
proxy_buffers 4 32k; | |
proxy_busy_buffers_size 64k; | |
proxy_temp_file_write_size 64k; | |
} | |
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ { | |
root /path/to/wordpress; #edit path to wordpress install | |
} | |
if (-f $request_filename) { | |
break; | |
} | |
if (-d $request_filename) { | |
break; | |
} | |
set $supercache_file .; | |
set $supercache_uri $request_uri; | |
if ($request_method = POST) { | |
set $supercache_uri .; | |
} | |
if ($query_string) { | |
set $supercache_uri .; | |
} | |
if ($http_cookie ~* .comment_author_|wordpress|wp-postpass_. ) { | |
set $supercache_uri .; | |
} | |
if ($supercache_uri ~ ^(.+)$) { | |
set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html; | |
} | |
if (-f $document_root$supercache_file) { | |
rewrite ^(.*)$ $supercache_file break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment