简体   繁体   English

在Nginx上显示重定向问题

[英]Display issue with redirect on nginx

today i installed a service called staytus on my server. 今天,我在服务器上安装了一个名为staytus的服务。 It is a ruby application and run on the port :8787 这是一个红宝石应用程序,并在端口上运行:8787

But i wan't it to run on port :80. 但我不想在端口:80上运行。 I have redirected the port via nginx with proxy_pass. 我已经使用proxy_pass通过nginx重定向了端口。 It worked but there is only the pure text shown. 它有效,但是仅显示纯文本。 Like without using the assets. 就像不使用资产一样。

Can anyone help me with this? 谁能帮我这个?

Nginx site-available default config: Nginx站点可用的默认配置:

 server { listen 0.0.0.0:80 default; listen [::]:80 default; server_name localhost; root /staytus/public; client_max_body_size 50M; location /assets { add_header Cache-Control max-age=3600; } location / { try_files $uri $uri/index.html $uri.html @puma; } location @puma { proxy_intercept_errors on; 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 http; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://127.0.0.1:8787; } } 

Thank you. 谢谢。

server {
    root /staytus/public;

    try_files $uri/index.html $uri @app;

    location @app {
        proxy_pass http://app;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
    }
    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}
upstream app {
    # Path to Puma
    server http://localhost:8087 fail_timeout=0;
}

source 资源

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

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