server_installation:nginx_proxy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
server_installation:nginx_proxy [2009/12/14 13:51] – aatre | server_installation:nginx_proxy [2017/04/11 09:33] (current) – Delete old experimental content to avoid confusion now that nginx has some official docs dbs | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 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... | ||
- | |||
- | < | ||
- | <ol> | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | < | ||
- | </ | ||
- | < | ||
- | listen 80; | ||
- | server_name test.concat.ca js-test.concat.ca css-test.concat.ca images-test.concat.ca; | ||
- | |||
- | root / | ||
- | |||
- | access_log / | ||
- | error_log / | ||
- | |||
- | location /js/ {} | ||
- | |||
- | location ~* \.(css|gif|jpg|jpeg|js|png)$ { | ||
- | rewrite " | ||
- | } | ||
- | |||
- | location / { | ||
- | rewrite ^(/?)$ / | ||
- | proxy_set_header X-Real-IP $remote_addr; | ||
- | proxy_set_header Host $host; | ||
- | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
- | proxy_pass http:// | ||
- | 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 { | ||
- | listen 443; | ||
- | server_name test.concat.ca js-test.concat.ca css-test.concat.ca images-test.concat.ca; | ||
- | |||
- | root / | ||
- | |||
- | ssl on; | ||
- | ssl_certificate / | ||
- | ssl_certificate_key / | ||
- | |||
- | access_log / | ||
- | error_log / | ||
- | |||
- | location /js/ {} | ||
- | |||
- | location ~* \.(css|gif|jpg|jpeg|js|png)$ { | ||
- | rewrite " | ||
- | } | ||
- | |||
- | location / { | ||
- | rewrite ^(/?)$ / | ||
- | proxy_set_header X-Real-IP $remote_addr; | ||
- | proxy_set_header Host $host; | ||
- | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
- | proxy_pass https:// | ||
- | 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:** | ||
- | |||
- | | ||
- | |
server_installation/nginx_proxy.1260816680.txt.gz · Last modified: 2022/02/10 13:34 (external edit)