Static content

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.

Best regards,
Maddy

Posted at Nginx Forum:

On Tue, Jun 30, 2015 at 12:19 PM, smsmaddy1981 [email protected]
wrote:

      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.

Hi Mike
Thanks for your reply
I did not understand your suggestion. Can you please elaborate with an
example

Regards,
Maddy

Posted at Nginx Forum:

Hi Mike

Thanks for your quick reply…

To answer your questions:

  • Upstream servers yes (where applications are deployed). And, not
    NGinx
    installations.
  • I tried accessing the static content on other servers, that isn’t
    working… I tried using root, rewrite,… directives.

Is it possible to share an code snippet to achieve this use case pls.?

Regards,
Maddy

Posted at Nginx Forum:

You said it yourself:
“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.”

Nginx expets the file to be on the server, and that’s how it works…
you need to either make them available in that server, in the path
you’re specifing or just “drop” that location block in this server.

Are you’re upstream server other nginx servers?

Melhores Cumprimentos // Best Regards