我正在使用nginx为我的服务器创建一个代理,我想确保对试图发现它的任何人隐藏proxy_pass服务器IP。基于以下服务器{}条目,是否可以发现xxx.xxx.xxx.xxx地址?
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
proxy_pass http://xxx.xxx.xxx.xxx; // Is this hidden?
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
答案 0 :(得分:0)
您可以这样配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
proxy_pass http://xxx.xxx.xxx.xxx;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
}
然后IP地址被隐藏,并且使用原始IP地址或域名。