以下是我在/conf.d
下的nginx反向代理的文件(default.conf)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://www.paypal.com;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rule
}
location /abc/{
proxy_set_header Host $host;
proxy_pass http://www.google.com;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rule
}
location /xyz/{
proxy_set_header Host $host;
proxy_pass http://www.youtube.com;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rule
}
当我直接点击我的ip时,我被重定向到paypal但是当我点击 ip / abc 或 / ip / xyz 时,我得到了404