小编Jes*_*sen的帖子

Nginx 反向代理,只允许来自主机名的连接,而不允许来自 ip 的连接

是否可以只允许用户输入 xxxxxx.com(虚构),因此他们应该进行 DNS 查找并连接。并阻止使用我的公共 IP 进行连接的用户?

\n\n

配置:

\n\n
server {\nlisten 80;\nreturn 301 https://$host$request_uri;\n}\n\nserver {\n\nlisten 443;\nserver_name xxxxxxx.com;\n\nssl_certificate           /etc/nginx/ssl/server.crt;\nssl_certificate_key       /etc/nginx/ssl/server.key;\n\nssl on;\nssl_session_cache  builtin:1000  shared:SSL:10m;\nssl_protocols  TLSv1 TLSv1.1 TLSv1.2;\nssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;\nssl_prefer_server_ciphers on;\n\naccess_log            /var/log/nginx/jenkins.access.log;\n\nlocation / {\n\n  proxy_set_header        Host $host;\n  proxy_set_header        X-Real-IP $remote_addr;\n  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;\n  proxy_set_header        X-Forwarded-Proto $scheme;\n\n  # Fix the \xe2\x80\x9cIt appears that your reverse proxy set up is broken" error.\n  proxy_pass          http://10.0.11.32:80;\n  proxy_read_tenter code hereimeout  360;\n\n  proxy_redirect      http://10.0.11.32:80 https://xxxxxxx.com;\n}\n}\n
Run Code Online (Sandbox Code Playgroud)\n

dns reverse-proxy nginx hostname

4
推荐指数
1
解决办法
8359
查看次数

标签 统计

dns ×1

hostname ×1

nginx ×1

reverse-proxy ×1