我创建了一个域名,并将其重新定义为您的外部IP地址。也启动nginx和tomcat。 将域重新定义为外部IP地址。
我想隐藏端口8081和数据包/ spring /
现在我有一些设置 的 nginx.conf
server {
listen 81;
server_name www.truckpart4you.com truckpart4you.com;
access_log logs/host.access.log main;
location / {
proxy_pass localhost:81/;
proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}}
和 server.xml (对于tomcat)
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"/>
如何为vindovs配置nginx和tomcat?
答案 0 :(得分:1)
Nginx配置:
server {
listen 81; # why 81 instead of 80???
server_name www.truckpart4you.com truckpart4you.com;
access_log logs/host.access.log main;
location / {
proxy_pass http://localhost:8081;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
您的应用程序应该以{{1}}而不是http://localhost:8081/
部署在root中。您可以通过在标记内添加server.xml文件的部分来轻松完成此操作。
http://localhost:8081/spring/.