From 8f59a7b99ec7989b8aa759270d1df1789a8da3dd Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 20 Jun 2014 00:46:24 -0400 Subject: software/nginx: example config files --- software/nginx.page | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 software/nginx.page (limited to 'software') diff --git a/software/nginx.page b/software/nginx.page new file mode 100644 index 0000000..2bd3d97 --- /dev/null +++ b/software/nginx.page @@ -0,0 +1,94 @@ + +Here are some templates for reverse-proxy + wildcard SSL hosting. + +/etc/nginx/sites-enabled/default: + + server { + listen 80 default; ## listen for ipv4; this line is default and implied + listen [::]:80 default ipv6only=on; ## listen for ipv6 + + access_log /var/log/nginx/access.log; + + location / { + root /srv/http/default/www; + index index.html index.htm feed.xml; + } + + # redirect server error pages to the static page /50x.html, /404.html + error_page 404 /404.html; + error_page 500 502 503 504 /50x.html; + location = /404.html { + root /srv/http/default/www; + } + location = /50x.html { + root /srv/http/default/www; + } + } + + server { + listen 443; + listen [::]:443 ipv6only=on; + server_name *.YOURDOMAIN.HERE; + + ssl on; + ssl_certificate /etc/ssl/certs/YOUR_CERT_HERE.combined.crt; + ssl_certificate_key /etc/ssl/private/YOUR_KEY_HERE.key; + + location / { + proxy_pass http://localhost:80/; + proxy_set_header host $host; + } + } + +/etc/nginx/sites-available/example_static: + + + server { + listen 80; ## listen for ipv4; this line is default and implied + listen [::]:80; ## listen for ipv6 + server_name STATIC.YOURDOMAIN.HERE; + + access_log /var/log/nginx/static.access.log; + error_log /var/log/nginx/static.error.log; + + location / { + root /srv/http/YOUR_STATIC_PATH_HERE; + #index index.html index.htm; + autoindex on; + #autoindex_exact_size off; + } + + location /SOME_USER { + alias /home/SOME_USER/www; + index index.html index.htm; + autoindex on; + } + } + +/etc/nginx/sites-available/example_proxy: + + + server { + listen 80; ## listen for ipv4; this line is default and implied + listen [::]:80; ## listen for ipv6 + server_name mailman mailman.YOUR_DOMAIN.HERE; + + access_log /var/log/nginx/mailman.access.log; + error_log /var/log/nginx/mailman.error.log; + + location = / { + rewrite ^ /mailman/listinfo permanent; + } + + location / { + rewrite ^ /mailman$uri?$args; + } + + location /mailman/ { + include proxy_params; + proxy_pass http://127.0.0.1:5001/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + } + -- cgit v1.2.3