Static content

Miguel C miguelmclara at gmail.com
Tue Jun 30 14:35:38 UTC 2015


On Tue, Jun 30, 2015 at 12:19 PM, smsmaddy1981 <nginx-forum at nginx.us> wrote:
> Hi,
> I have NGinx 1.8.0 installed successfully and configured NGinx... with
> upstream servers provided. NGinx and Services are deployed on separate
> machines. Now, when an request is made via NGinx, the service is invoked
> resulting in UI with no static content loaded.
>
> I have tried root, rewrite directives... to specify the static content path
> on another server (workspace.corp.test.no), which didn't helped. I might be
> wrong with configuration. Pls. assist
>
>
>     server {
>        listen 80;
>        server_name workspace.corp.test.no;
>
>        location ~"*\.(js|jpg|png|css)$" {
>            root /workspace/WEB-INF/classes/static;
>            expires 30d;
>        }
>
>        location /{
>           proxy_pass http://workspace.corp.test.no/workspace/agentLogin/;
>        }
>     }
>
>
> And, the above configuration is expecting static content on the server where
> NGinx is installed, when an request is made. But, I expect the static
> content to be expected from remote server.
>
That is the problem! You're telling it the static content is in the
local system at '/workspace/WEB-INF/classes/static' when its not...

Assuming the "frontend" is proxying to another nginx server you
should only define "location ~"*\.(js|jpg|png|css)$" {" in the 'inner'
(for lack of a better term) nginx server.

>
>
> Best regards,
> Maddy
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259989,259989#msg-259989
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list