Configure http server to only listen on known vhosts/IP

For the rest it returns 404

Fixes #446
This commit is contained in:
Girish Ramakrishnan
2017-10-26 21:50:16 -07:00
parent d127b25f0f
commit 3dedda32d4
3 changed files with 42 additions and 20 deletions

View File

@@ -36,28 +36,15 @@ http {
# zones for rate limiting
limit_req_zone $binary_remote_addr zone=admin_login:10m rate=10r/s; # 10 request a second
# HTTP server
# default http server that returns 404 for any domain we are not listening on
server {
listen 80;
listen [::]:80;
# collectd
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
# acme challenges
location /.well-known/acme-challenge/ {
default_type text/plain;
alias /home/yellowtent/platformdata/acme/;
}
listen 80 default_server;
listen [::]:80 default_server;
server_name does_not_match_anything;
location / {
# redirect everything to HTTPS
return 301 https://$host$request_uri;
return 404;
}
}