使用nginx配置WSO2

mnemlml8  于 2023-05-16  发布在  Nginx
关注(0)|答案(1)|浏览(155)

我正在使用wso 2am版本4.1.0,并尝试使用Nginx配置反向代理。根据要求,我需要使用nginx配置中提供的URL打开devportal/carbon/publisher。我可以直接使用hostname打开WSO 2,但是使用nginx提供的url,我得到了404错误。下面是nginx的配置。善意的帮助与建议

server {
server_name name1.com default_server;

root /usr/share/nginx/name1;
index index.html index.htm;

 location /abc/ {
    proxy_set_header Host $host;
    proxy_pass https://wso2dev.com:8243/abc/;
}

location /devportal/ {
        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;
        proxy_set_header Host $host;
        proxy_read_timeout 5m;
        proxy_send_timeout 5m;
        proxy_pass https://wso2dev.com:9443/devportal;
    }

location / {

    try_files $uri $uri/ /index.html;

}
error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/name1;
}

}

kr98yfug

kr98yfug1#

最简单的方法是将根上下文Map到目标端口。否则,您将不得不添加更多的URLMap。

server {
    server_name name1.com default_server;
 root /usr/share/nginx/name1;
   index index.html index.htm;
    location / {
            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;
            proxy_set_header Host $host;
            proxy_read_timeout 5m;
            proxy_send_timeout 5m;
            proxy_pass https://wso2dev.com:9443;
        }

请参考this以获取完整的示例。

相关问题