server_installation:nginx_proxy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
server_installation:nginx_proxy [2009/10/18 01:30] – Slight updates - include port_in_redirect directive dbs | 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 ====== | ||
- | 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; | ||
- | |||
- | 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; | ||
- | } | ||
- | |||
- | } | ||
- | |||
- | server { | ||
- | listen 443; | ||
- | |||
- | 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; | ||
- | } | ||
- | } | ||
- | </ | ||
server_installation/nginx_proxy.1255843850.txt.gz · Last modified: 2022/02/10 13:34 (external edit)