nginx.conf修改如下
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
server_name 127.0.0.1;
charset utf-8;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://localhost:9900;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
重新启动后,访问http://localhost
只是显示nginx成功启动,并没有跳转,在任务管理器中,进程里没有nginx,但是在用户下可能会有多个nginx,这是问题所在。通过命令taskkill /IM nginx.exe /F 去关闭所有nginx进程。重新启动后,就能正常跳转。