server_installation:nginx_proxy
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
server_installation:nginx_proxy [2009/10/04 01:29] – created nginx documentation dbs | server_installation:nginx_proxy [2009/12/14 13:51] – aatre | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using nginx to serve static content ====== | ====== Using nginx to serve static content ====== | ||
+ | **Warning**: | ||
+ | |||
A default Evergreen install uses Apache to serve up both static and dynamic content. This causes Apache to have to constantly respawn backend processes. Using a high-performance proxy server to serve up static content and pass on the dynamic requests to Apache can make you, your server, and your users happier. The following document is based on a full handful of late-night hours trying out nginx for the first time, so use at your own risk... | A default Evergreen install uses Apache to serve up both static and dynamic content. This causes Apache to have to constantly respawn backend processes. Using a high-performance proxy server to serve up static content and pass on the dynamic requests to Apache can make you, your server, and your users happier. The following document is based on a full handful of late-night hours trying out nginx for the first time, so use at your own risk... | ||
Line 5: | Line 7: | ||
<ol> | <ol> | ||
< | < | ||
- | < | + | < |
+ | < | ||
< | < | ||
< | < | ||
+ | < | ||
< | < | ||
+ | < | ||
< | < | ||
</ | </ | ||
- | < | + | < |
- | # Change "192.168.69.107" throughout to match your server' | + | |
+ | server_name test.concat.ca js-test.concat.ca css-test.concat.ca images-test.concat.ca; | ||
- | server { | ||
- | listen 192.168.69.107: | ||
- | |||
- | server_name 192.168.69.107; | ||
root / | root / | ||
Line 36: | Line 38: | ||
proxy_pass http:// | proxy_pass http:// | ||
proxy_redirect off; | proxy_redirect off; | ||
+ | port_in_redirect off; | ||
+ | |||
+ | if ($request_uri ~* " | ||
+ | expires 31d; | ||
+ | break; | ||
+ | } | ||
+ | |||
} | } | ||
+ | |||
+ | # Enable compression of content | ||
+ | gzip on; | ||
+ | |||
+ | # IE 6 doesn' | ||
+ | # You may disable this feature if you are | ||
+ | # running nginx 0.6.23 or higher (nginx -V) | ||
+ | # by uncommenting the line below. | ||
+ | # gzip_disable "MSIE [1-6]\."; | ||
+ | |||
+ | # Compress proxied content as well - enables XML / XUL files | ||
+ | # to be compressed after XMLENT has had its way with them | ||
+ | gzip_proxied any; | ||
+ | |||
+ | # By default, nginx only compresses text/html | ||
+ | gzip_types text/html text/plain text/xml text/css application/ | ||
+ | |||
+ | # Ensure that large content (the most important stuff) can be compressed | ||
+ | gzip_buffers 16 8k; | ||
} | } | ||
server { | server { | ||
- | listen | + | listen 443; |
- | server_name | + | server_name |
root / | root / | ||
ssl on; | ssl on; | ||
- | ssl_certificate / | + | ssl_certificate / |
- | ssl_certificate_key / | + | ssl_certificate_key / |
access_log / | access_log / | ||
Line 65: | Line 94: | ||
proxy_pass https:// | proxy_pass https:// | ||
proxy_redirect off; | proxy_redirect off; | ||
+ | port_in_redirect off; | ||
+ | |||
+ | if ($request_uri ~* " | ||
+ | expires 31d; | ||
+ | break; | ||
+ | } | ||
+ | |||
} | } | ||
+ | |||
+ | # Enable compression of content | ||
+ | gzip on; | ||
+ | |||
+ | # IE 6 doesn' | ||
+ | # You may disable this feature if you are | ||
+ | # running nginx 0.6.23 or higher (nginx -V) | ||
+ | # by uncommenting the line below. | ||
+ | # gzip_disable "MSIE [1-6]\."; | ||
+ | |||
+ | # Compress proxied content as well - enables XML / XUL files | ||
+ | # to be compressed after XMLENT has had its way with them | ||
+ | gzip_proxied any; | ||
+ | |||
+ | # By default, nginx only compresses text/html | ||
+ | gzip_types text/html text/plain text/xml text/css application/ | ||
+ | |||
+ | # Ensure that large content (the most important stuff) can be compressed | ||
+ | gzip_buffers 16 8k; | ||
} | } | ||
</ | </ | ||
+ | **External Reference Links:** | ||
+ | | ||
+ | |