首页 > 代码库 > nginx 解决css、js请求路径无法加载问题

nginx 解决css、js请求路径无法加载问题

        location / {
        proxy_pass http://jfinaldemo;
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        client_max_body_size    1000m;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
           proxy_pass http://jfinaldemo;
        }

        location ~ .*\.(js|css)?$
        {
            proxy_pass http://jfinaldemo;
        }

解决方法如上。主要是下面两个配置项的修改

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
           proxy_pass http://jfinaldemo;
        }

        location ~ .*\.(js|css)?$
        {
            proxy_pass http://jfinaldemo;
        }

nginx 解决css、js请求路径无法加载问题