简体   繁体   English

将 nginx 配置为 Wildfly Web 应用程序的反向代理

[英]Confgure nginx as reverse proxy for wildfly web applications

I have a webapp deployed on a wildfly 10.1 application server.我在 Wildfly 10.1 应用程序服务器上部署了一个 webapp。 This webapp is listened on: http://localhost:8080/app-profile-jsp/ (1)这个 webapp 被监听: http://localhost:8080/app-profile-jsp/ (1)

I successful installed nginx.我成功安装了nginx。 The server is successfull installed and I test to serve static web pages and images.服务器安装成功,我测试提供静态网页和图像。

Now I want configure nginx to acccess the web app from " http://www.frizio.local " (2) url.现在我想配置 nginx 以从“ http://www.frizio.local ” (2) url 访问网络应用程序。 I configure this address in /etc/hosts.我在 /etc/hosts 中配置了这个地址。

My configuration in nginx is the following:我在 nginx 中的配置如下:

server {
    listen          80;
    server_name     frizio.local www.frizio.local;

    access_log      /var/log/nginx/static.access.log;
    error_log       /var/log/nginx/static.error.log;

    root /srv/http/static;


    location / {
            proxy_pass  http://localhost:8080/app-profile-jsp;
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
            proxy_redirect off;

            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_set_header    X-Forwarded-Proto https;

    }


    location /pics {
            autoindex on;
            autoindex_exact_size off;
    }
}

When I try to access to (2) the server respond "404 not found".当我尝试访问 (2) 时,服务器响应“404 not found”。

Thanks in advance提前致谢

I think you missed the trailing / of the proxypass :我想你错过了 proxypass 的尾随 / :

proxy_pass  http://localhost:8080/app-profile-jsp/;

An other thing, I don't think you need the proxy_redirect off;另一件事,我认为您不需要proxy_redirect off; here.这里。

Hope it helped !希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM