From 36a15b629005b293123043882e8b2c970a99f8b7 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 20 Oct 2013 01:10:05 +0200 Subject: Let Nginx listen on specific IP address Let Nginx listen on 130.133.8.40 instead of 0.0.0.0, and allow for serving additional SSL domains. diff --git a/etc/nginx.conf b/etc/nginx.conf new file mode 100644 index 0000000..4c74584 --- /dev/null +++ b/etc/nginx.conf @@ -0,0 +1,98 @@ +# +# Nginx server configuration for the Nagios Plugins. +# +# See: +# /usr/share/doc/nginx-doc/examples +# +# http://wiki.nginx.org/Pitfalls +# http://wiki.nginx.org/QuickStart +# http://wiki.nginx.org/Configuration +# + +# +# Server definition for . +# +server { + listen 130.133.8.40:443 ssl; + listen 130.133.8.40:444 ssl; + server_name www.nagios-plugins.org; + ssl_certificate /home/plugins/etc/ssl/nagios-plugins.crt; + ssl_certificate_key /home/plugins/etc/ssl/nagios-plugins.key; + root /home/plugins/web/port-$server_port; + + # + # Downloads and attachments. + # + location ^~ /attachments/ { + root /home/plugins/web; + } + location ^~ /download/ { + root /home/plugins/web; + fancyindex on; + fancyindex_exact_size off; + fancyindex_css_href /resources/plugins.css; + } + + # + # Mailman and cgit. + # + location ^~ /cgit { + root /home/git/opt/cgit/web; + } + location ^~ /list/icons/ { + alias /home/mailman/server/icons/; + } + location ~ ^/list/?$ { + return 301 /list/listinfo; + } + location ~ ^/(?:list/|repositories) { + root /home/plugins/web/cgi-bin; + fastcgi_split_path_info ^(/list/[^/]+|/repositories)(.*)$; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + include /etc/nginx/fastcgi_params; + gzip off; # Scripts have to complete before getting gzipped. + } + + # + # Redirects etc. + # + location = /favicon.ico { + root /home/plugins/web/site/resources; + } + location = /doc/release-notes/1-5.html { + return 301 /news/release-1-5.html; + } + location = /download/snapshot/nagios-plugins-HEAD.tar.gz { + return 301 /download/snapshot/nagios-plugins-master.tar.gz; + } + location = /taxonomy/term/2 { + return 301 /doc/presentation.html; + } + location ^~ /snapshot { + return 301 /download$request_uri; + } + location ~ ^/(?:man.*|guidelines|extra-opts)$ { + return 301 /doc$request_uri.html; + } +} + +# +# Redirect HTTP and all other domains to . +# Ditto for the test instance. +# +server { + listen 130.133.8.40:80 default_server; + listen 130.133.8.40:443 default_server ssl; + ssl_certificate /home/plugins/etc/ssl/nagios-plugins.crt; + ssl_certificate_key /home/plugins/etc/ssl/nagios-plugins.key; + return 301 https://www.nagios-plugins.org$request_uri; +} +server { + listen 130.133.8.40:81 default_server; + listen 130.133.8.40:444 default_server ssl; + ssl_certificate /home/plugins/etc/ssl/nagios-plugins.crt; + ssl_certificate_key /home/plugins/etc/ssl/nagios-plugins.key; + return 301 https://www.nagios-plugins.org:444$request_uri; +} diff --git a/etc/nginx/site.conf b/etc/nginx/site.conf deleted file mode 100644 index 9e94bf6..0000000 --- a/etc/nginx/site.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -# Nginx server configuration for the Nagios Plugins. -# -# See: -# /usr/share/doc/nginx-doc/examples -# -# http://wiki.nginx.org/Pitfalls -# http://wiki.nginx.org/QuickStart -# http://wiki.nginx.org/Configuration -# - -# -# Server definition for . -# -server { - listen 443 ssl; - listen 444 ssl; - server_name www.nagios-plugins.org; - root /home/plugins/web/port-$server_port; - - # - # Downloads and attachments. - # - location ^~ /attachments/ { - root /home/plugins/web; - } - location ^~ /download/ { - root /home/plugins/web; - fancyindex on; - fancyindex_exact_size off; - fancyindex_css_href /resources/plugins.css; - } - - # - # Mailman and cgit. - # - location ^~ /cgit { - root /home/git/opt/cgit/web; - } - location ^~ /list/icons/ { - alias /home/mailman/server/icons/; - } - location ~ ^/list/?$ { - return 301 /list/listinfo; - } - location ~ ^/(?:list/|repositories) { - root /home/plugins/web/cgi-bin; - fastcgi_split_path_info ^(/list/[^/]+|/repositories)(.*)$; - fastcgi_pass unix:/var/run/fcgiwrap.socket; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - include /etc/nginx/fastcgi_params; - gzip off; # Scripts have to complete before getting gzipped. - } - - # - # Redirects etc. - # - location = /favicon.ico { - root /home/plugins/web/site/resources; - } - location = /doc/release-notes/1-5.html { - return 301 /news/release-1-5.html; - } - location = /download/snapshot/nagios-plugins-HEAD.tar.gz { - return 301 /download/snapshot/nagios-plugins-master.tar.gz; - } - location = /taxonomy/term/2 { - return 301 /doc/presentation.html; - } - location ^~ /snapshot { - return 301 /download$request_uri; - } - location ~ ^/(?:man.*|guidelines|extra-opts)$ { - return 301 /doc$request_uri.html; - } -} - -# -# Redirect HTTP and all other domains to . -# Ditto for the test instance. -# -server { - listen 80 default_server; - listen 443 default_server ssl; - return 301 https://www.nagios-plugins.org$request_uri; -} -server { - listen 81 default_server; - listen 444 default_server ssl; - return 301 https://www.nagios-plugins.org:444$request_uri; -} diff --git a/etc/nginx/ssl.conf b/etc/nginx/ssl.conf deleted file mode 100644 index 04f029a..0000000 --- a/etc/nginx/ssl.conf +++ /dev/null @@ -1,6 +0,0 @@ -# -# Nginx SSL configuration for the Nagios Plugins. -# -ssl_certificate /home/plugins/etc/ssl/nagios-plugins.crt; -ssl_certificate_key /home/plugins/etc/ssl/nagios-plugins.key; -ssl_session_cache shared:SSL:10m; -- cgit v0.10-9-g596f