Host: Ali Cloud ECS
Environment: CentOS 7.6
neither reverse proxy nor redirection succeeded
PS: found that even the default welcome page cannot be accessed.
default.conf
is configured as follows:
server {
listen 80;
server_name 127.0.0.1;
error_page 500 502 503 504 /50x.html;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /api {
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-Real-IP $remote_addr;
}
location /baidu {
return 302 https://www.baidu.com$request_uri;
}
}
running status:
$ ps -ef |grep nginx
root 31126 1 0 02:42 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 31127 31126 0 02:42 ? 00:00:00 nginx: worker process
root 31155 13304 0 02:46 ? 00:00:00 /opt/appnode/agent/apps/nginx/anapp-nginx
root 31212 31187 0 02:51 pts/0 00:00:00 grep --color=auto nginx
check configuration file:
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
it is expected that
visit http://< host IP >
will enter the welcome page of nginx
visit http://< host IP > / api
will call port 5000
access http://< host IP > / baidu
will be redirected to baidu
what could be the reason for this?
how should I troubleshoot?
Thank you!