我有域名http://xyzabc.com,我在本地机器上托管了几个示例应用程序。
由于我的ISP 阻塞了端口80,所以我必须将我的域名转发到端口81;所以我在godaddy中定义了转发(http://xx.xx.xx.xx:81),并配置了两个子域foo.xyzabc.com和bar.xyzabc.com,并分别使用转发作为(http://xx.xx.xx.xx:81)和(http://xx.xx.xx.xx:81)。
在我的路由器上,我定义了端口转发以将外部端口81映射到内部端口80,在该端口上nginx正在运行。
在此之前,每件事都在用http://xyzabc.com,http://foo.xyzabc.com和我的主要网站内容。
现在,我想将tomcat映射到http://foo.xyzabc.com到http://localhost:8080/,而我很困惑如何配置它。
我试过的是:
server {
listen 80;
server_name foo.xyzabc.com
location / {
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Port 81;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect http://xx.xx.xx.xx:81/ http://localhost:8080/;
}}
和
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
}和很多置换组合,但是当输入http://foo.xyzabc.com/时,我无法获得Tomcat网页。
我非常感谢在这方面的任何帮助。
发布于 2017-06-10 16:02:00
您是否在您的server_name块中设置了server参数?
例如:
server {
listen 80
server_name foo.xyzabc.com;
location / {
...
}
}https://stackoverflow.com/questions/44470984
复制相似问题