Nginx – JS and CSS Files Not Loading Due to Missing Forward Slash

nginx

My client moved to new server which nginx & percona server. Problem is the forward slash is being removed from end of the url. as you can see on the picture http://imgur.com/8OAUQZb

therefor the design files such as js, css files are not loading or something it gives magento 404 not found page. it happens randomly.

on the database web/unsecure/base_url and web/secure/base_url are set with forward slash http://domain.com/

I'm assuming something wrong with nginx file. The rewrite rules might be wrong. I have tried every possible way that I found on this website and on google but nothing work. It might be something else. Could you please help?

This is nginx conf file for the domain

# Uncomment the server definition below should you wish to
# redirect from domain.com to www.domain.com
#server {
#    listen 192.168.92.247;
#    server_name domain.com;
#    #rewrite / $scheme://www.$host$request_uri permanent;
#}

#
# Change this backend name (and the socket pointer)
# as additional virtual hosts are added. This should
# point to the spawn-fcgi wrapper running as the
# appropriate user.
#
upstream domaincombackend {
        server unix:/var/run/php-fcgi-domaincom.sock;
}

server {
    listen 192.168.92.247:80;
    server_name punkyfish.com;
    root /var/www/vhosts/domain.com/htdocs;

    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
        expires 30d;
    }

    location /app/                { deny all; }
    location /includes/           { deny all; }
    location /lib/                { deny all; }
    location /media/downloadable/ { deny all; }
    location /pkginfo/            { deny all; }
    location /report/config.xml   { deny all; }
    location /var/                { deny all; }

    location  /. {
        return 404;
    }

    location @handler {
       rewrite / /index.php;
    }

    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    include "ssl_offloading.inc";
    location ~ .php$ {
        if (!-e $request_filename) { rewrite / /index.php last; }

        expires        off;
        fastcgi_pass   domain.combackend;
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
#       fastcgi_param  MAGE_RUN_CODE default;
#       fastcgi_param  MAGE_RUN_TYPE store;
        include        fastcgi_params;
    }

Best Answer

This was due to nginx was caching everything. regardless of my changes on db and files wasn't reflecting. I cleaned the cache from ngnix cache folder and problem solved.

Thanks.