• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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