Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful nginx virtual host configuration for reverse proxy (proxy_pass) with Apache
# 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
You can’t perform that action at this time.