• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue nginx proxypass not working for static files

becker.enterprises

New Pleskian
Server operating system version
Ubuntu 18.04
Plesk version and microupdate number
18.0.50
I try to load some files via an external server, so I added proxypass directives to the configuration of my domain.
This does work fine for non static files but with static files, nginx always tries to serve them which results in a 404.
I disabled serving of static files and intelligent serving too. Proxymode is the only thing I left checked.

How can I tell nginx to not serve any static files?
Here is a screenshot of my configuration:

2023-03-06_171612.png
 
@becker.enterprises

On the one hand, your location config is to strict with : location /cdn/

I cannot verify it, but that location directive should never get the desired result - Nginx will not associate (any or many) requests to that location, so whatever is included in the location directive will not be used : it is to some extent "dead" config.

On the other hand, you should try to use the return directive (as opposed to the proxy_pass).

The return directive can be more efficient and practical, unless you have the goal to cache specific requests on the local server - you probably will not have that goal, since otherwise the usage of a CDN would be rather contradictory.

In short, please try to

1 - fine-tune the location directive config
2 - use the return directive

and also try to consider to make your Nginx config a bit more elaborate - explicit config (read: more lines of config variables) is always better with Nginx.

Kind regards....
 
Thanks for your reply.

The return directive will not work in this case, because the server is an internal Thumbor Server which is not accessible to the web.
Maybe my example with the url was a misleading.

With the fine tuning, I am a little bit lost here :(

But I can say, if I request a file, which is not known as static file by plesk as default, for example webp or any other, the proxy is working like expected.
When I use a file like png/jpg/css etc. I get a 404, because nginx is looking locally for the file and then fails.
 
Back
Top