简体   繁体   中英

Display issue with redirect on nginx

today i installed a service called staytus on my server. It is a ruby application and run on the port :8787

But i wan't it to run on port :80. I have redirected the port via nginx with proxy_pass. 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:

 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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