server_installation:nginx_proxy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
server_installation:nginx_proxy [2009/10/21 06:10] – Add server names to nginx configuration 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 6: | Line 8: | ||
< | < | ||
< | < | ||
+ | < | ||
< | < | ||
< | < | ||
+ | < | ||
< | < | ||
+ | < | ||
< | < | ||
</ | </ | ||
< | < | ||
listen 80; | listen 80; | ||
- | + | | |
- | # List the server names here that you want nginx to respond to | + | |
- | | + | |
root / | root / | ||
Line 36: | Line 39: | ||
proxy_redirect off; | proxy_redirect off; | ||
port_in_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; | ||
} | } | ||
Line 42: | Line 70: | ||
server { | server { | ||
listen 443; | listen 443; | ||
- | + | | |
- | # List the server names here that you want nginx to respond to | + | |
- | | + | |
root / | root / | ||
ssl on; | ssl on; | ||
- | ssl_certificate / | + | ssl_certificate / |
- | ssl_certificate_key / | + | ssl_certificate_key / |
access_log / | access_log / | ||
Line 69: | Line 95: | ||
proxy_redirect off; | proxy_redirect off; | ||
port_in_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:** | ||
+ | | ||
+ | |