Welcome! Log In Create A New Profile

Advanced

Re: trouble with static content (Revised)

Francis Daly
November 07, 2021 08:24AM
On Sun, Nov 07, 2021 at 07:01:58AM -0500, deeztek wrote:

Hi there,

> With the following configuration, I get static content on the /admin
> location but NOT the / location:

Can you give some specific examples of requests that you make, responses
that you get, and responses that you want to get instead?

Normally, in the context of nginx, "static content" means "requests
that should be served by nginx direct from the filesystem". It is not
immediately clear to me that that is the meaning that you are using.

The "location" blocks that you have defined (apart, perhaps, from anything
that was "include"d from other files, are

> location /.well-known {
> root /var/www/html/;
> }

> location / {
> set $upstream_authelia http://127.0.0.1:9091;
> proxy_pass $upstream_authelia;
> }

> location ~* .(?:ico|css|js|gif|jpe?g|png|woff2|map)$ {
> expires max;
> }

> location /admin/ {
> proxy_pass http://localhost:8888;
> }

So for each request that you make, it should be clear which on location{}
is used to serve it.

Any request that matches the regex location will be served from the
filesystem, using whatever the compile-time default "root" value was.

Any other request that starts with /.well-known will be served from
below /var/www/html/.

Any other request that starts with /admin/ will be proxy_pass'ed to one
other server.

Any other request will be proxy_pass'ed to a different other server.

So, for example, a request for /one.js will come from (something like)
/usr/local/nginx/html/one.js; and a request for /admin/two.js will come
from /usr/local/nginx/html/admin/two.js; or give a 404 if the file does
not exist.

What response do you get from

curl -v https://your_domain/one.js

?

> However, if I remove the following from the configuration above, I get
> static content from the / location but NOT the /admin location:

In the case, the same thing applies, except now the request doe snot
come from the filesystem.

/one.js will be proxy_pass'ed to port 9091, and /admin/two.js will be
proxy_pass'ed to port 8888.

When you don't get the static content -- what do you get instead?

Cheers,

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

trouble with static content (Revised)

deeztek November 07, 2021 07:01AM

Re: trouble with static content (Revised)

Francis Daly November 07, 2021 08:24AM

Re: trouble with static content (Revised)

deeztek November 07, 2021 08:46AM

Re: trouble with static content (Revised)

Francis Daly November 07, 2021 10:08AM

Re: trouble with static content (Revised)

deeztek November 07, 2021 11:00AM

Re: trouble with static content (Revised)

Francis Daly November 07, 2021 12:30PM

Re: trouble with static content (SOLVED)

deeztek November 08, 2021 06:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 59
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready