我正在使用 nginx 服务器(nginx 版本:nginx/1.10.0 (Ubuntu))创建了一个 Tomcat 8 配置/etc/nginx/conf.d/tomcat.conf
server {
listen 80;
root /opt/tomcat/webapps/ROOT/;
server_name mysite.com;
server_name_in_redirect off;
access_log /var/log/nginx/site/site_access.log;
error_log /var/log/nginx/site/site_error.log debug;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cookie_path ~*^/.* /;
proxy_pass http://localhost:8080;
}
}
www.site.com
正在显示 Welcome to nginx 并且我的 tomcat 项目正在显示http://ip:8080
。
问题是www.site.com
没有重定向到 8080