• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Random 404 Apache + Nginx Reverse Proxy

EmilioO

Basic Pleskian
OS: Ubuntu 16.04
Plesk: 18.0.33

Since several month newly created domain or subdomains that has enabled Nginx as reverse proxy stop working properly: Its random generate 404 errors (If you refresh the page 10 times generate about 70% error).

I've try repairing web, fs and checking any combination in "Apache Nginx additional settings" without success.
I've try only with static files for discard any php fpm related problems
If I set the domain to only serve files by Nginx it works
If I disable Nginx for only e serve files with apache it works (/usr/local/psa/admin/sbin/nginxmng --disable)
Logs doesn't have any error or warning (I've set Nginx log to debug and trace1)

Any clue ?
 

Attachments

  • Captura de pantalla 2021-01-31 a las 12.26.57.png
    Captura de pantalla 2021-01-31 a las 12.26.57.png
    228.2 KB · Views: 22
  • Captura de pantalla 2021-01-31 a las 12.27.03.png
    Captura de pantalla 2021-01-31 a las 12.27.03.png
    239.6 KB · Views: 21
  • Captura de pantalla 2021-01-31 a las 12.16.59.png
    Captura de pantalla 2021-01-31 a las 12.16.59.png
    115.6 KB · Views: 22
The issue is caused by caching and proxying of unreal static files. You probably have rewrites in your .htaccess file to create fake static addresses for search engines. These work as long as the scripts that generate the output are addressed and executed directly. But once delivered, Nginx recognizes these address as static files that is has cached and tries to deliver such resources from its cache or directly from disk on further browser requests. This fails, because at the given location, there are no such files. Another related issue can be that some "images" are not really image files, but generated on the fly as data streams resembling the format of an image file by scripts. This can also cause a "not found" error, because the files are not actually present on the hard disk.

You can try to disable Nginx caching and see if this works. You can also try to change the automatic proxying for static files to specific static file extensions and remove all the extensions from the list that Nginx shall not serve as static files.
 
Hi, there is not .htaccess file on domain I'm using for testing only a plain html file in dir.
Nginx caching Is disabled, I also delete /var/cache.. files and disabled all Nginx cache for all domains (one by one)
 

Attachments

  • Captura de pantalla 2021-01-31 a las 17.54.51.png
    Captura de pantalla 2021-01-31 a las 17.54.51.png
    41.9 KB · Views: 17
If you are using a physically present static file and have turned Nginx caching off, you will need to look for additional webserver directives either in the panel (where you also configure Nginx settings) or in /var/www/vhosts/system/<domain name>/conf or in the general server configuration files in /etc/nginx and /etc/httpd for such directives that do rewrites or cache control. You should also verify all DNS settings to make sure that no third party caching is used, e.g. Cloudflare caching, and that no round robin name resolution is used, e.g. different targets for the same name.
 
@EmilioO did you solve your issue?
I was searching for a solution to the same problem.
Apparently it's working now after some steps I've made (I think it's a bug).
Here is the steps I've made:
- Updated to the last version 18.0.34
- Checked if it has fixed the problem, but not.
- Rebooted the whole server.
- It works.
 
No I've not resolved the issue on my server, Now I have disabled nginx package. I think that it's a apache related problem more than nginx side.
I will test by rebooting the server.
Thanks!
 
Did you find any solutions for this issue?
I still haven't found a proper solution, but the reboot works.

The problem is that you have to reboot the whole server for every new website that faces this issue.

Maybe there's a bunch of commands that would replace the need of a reboot, but still, not a proper solution.
 
I've just tested it (restart Apache + nginx) and it works.
Thanks.

I've created another subscription for this test and it's working without the bug, so apparently the bug was gone at all after this restart.

I could be wrong, but I remember doing this before and not fixing...
Maybe it's a random bug, maybe it has been fixed in a minor update... Idk.

I'll keep an eye on this...

Thanks.
 
We're seeing this issue as well -- it's been occurring for months. For us restarting nginx and apache doesn't solve the problem, it takes running the following to repair this each time, effectively forcing the reconfiguration of nginx as a reverse proxy:

Code:
nginxmng -e

It seems to occur roughly once every month or two per Plesk server and it only affects newly added domains or subdomains, and not any existing ones.

It has occurred across many Plesk updates and we *might* have seen our first instance of it around fall of 2020.

My best guess is when adding the domain something gets missed in the nginx configuration file that Plesk's scripts are outputting.
 
Have you tried to disable Nginx caching and to remove the Nginx cache files from the server?
 
Have you tried to disable Nginx caching and to remove the Nginx cache files from the server?
None of our service plans have nginx caching enabled so when these subscriptions are provisioned it isn’t enabled then either.

Unless there’s another area you’re referring to?

Maybe that’s the problem: perhaps Plesk is automatically enabling it in the configuration files, despite it not being enabled in our config, but not showing it in the GUI?
 
In another thread it was suggested that installing system PHP fixes it. When we do so, it also installs the following package which apparently was not installed when you only have Plesk PHP versions installed:

nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch

Certainly sounds like it could be relevant.
 
For testing, we now have 2 servers where we installed OS PHP packages and 2 servers where we *only* installed nginx-filesystem. We'll be tracking this to see if the issue returns on any of those servers.

For those also experiencing this issue, a couple questions:
  1. What OS are you using on the server where this is occurring?
  2. Do you have the OS PHP version installed?
  3. Do you have the nginx-filesystem package installed? (rpm -qa | grep nginx-filesystem will show you)
Thanks in advance for the additional data!

---

Also, the following threads are probably the same issue:
 
After many try / error test (disabled nginx, nginx cache, changing nginx/ apache options in domains) problem seems to has gone.
I don't know how to specify solve it, but it seems to be related to incorrect domain configuration options of reverse proxy and other nginx options stucked in some Plesk upgrade.
 
Back
Top