我是第一次与Nginx合作。
我已成功配置tomcat在不同的端口上运行。我的 tomcat正在以下端口上运行。
5.6.7.8:8080
5.6.7.8:8081
5.6.7.8:8082
我还在tomcat(每个实例)上部署了我的war文件。
我已按如下方式配置了我的nginx
在/etc/nginx/conf.d中创建了default.conf
根据以下链接Nginx Configuration
对文件进行了更改server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
# Make site accessible from http://localhost/
server_name 1.2.3.4;
location / {
proxy_pass http://www.example.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 /user/{
proxy_pass http://5.6.7.8:8080$uri;
# 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
}
}
我在SERVER TWO上部署的War文件的名称是示例
其中包含api /user/login?param1=xyz¶m2=abc¶m3=mno
当我点击1.2.3.4/user
时,为了得到结果,我需要改变一切谢谢
答案 0 :(得分:1)
唯一的问题是try_files我评论了try文件,并且每件事都正常工作。