Search code examples
ruby-on-railsnginxassets

No asset loaded when accessing cuttlefish.io web server thru nginx


When trying to run cuttlefish.io behind a nginx, assets (css, images, ...) are 404 not found. Cuttlefish server runs on localhost:3000, and here is my server configuration in nginx:

server
{
    server_name my.cuttlefish;
    listen 443 ssl;
    ssl_certificate /etc/nginx/ssl/be-s2534-msl.cer;
    ssl_certificate_key /etc/nginx/ssl/be-s2534-msl.key;
    root /soft/wordpress/home/tupromail/cuttlefish-master/public;

    location /
    {
        proxy_pass http://localhost:3000;
    }

   location  ^~ /assets/
   {
        gzip_static on;
        expires max;
        add_header Cache-Control 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;
    }

    client_max_body_size 1G;
    keepalive_timeout 10;
}

Is there something missing/wrong that prevents the assets to be loaded?

Thanks


Solution

  • Asset files should be in this location on nginx server:

    root /soft/wordpress/home/tupromail/cuttlefish-master/public/assets;