I have created a nginx proxy for the main the rails application. The main application is loading all the assets like css ,js , static images and everything. But the proxy server is loading application without any assets. No css,js or any assets.

Following is my /etc/nginx/sites-enabled/default

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;

  location ~* /(assets|fonts|swfs|images)/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;


Could somebody please help me figure out the issue?

  • 1
    You have try_files and proxy_pass in the same location. They are generally mutually exclusive. Commented Apr 5, 2018 at 12:42
  • @RichardSmith you were right. I removed the try_files and added it inside assets location in the end. It worked. Commented Apr 5, 2018 at 12:56


You must log in to answer this question.

Browse other questions tagged .