• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Apache with Nginx as a proxy is the only working configuration

Nag

New Pleskian
Hi.
Some weeks ago, after the Plesk update my sites stopped working (current version Plesk Onyx v17.5.3_build1705170317.16 os_CentOS 7). All of them began to show 403. Some of them were configured to use Apache fpm, some Nginx fpm. Trying to resolve the problem, I found that the only working configuration was to use Apache-fpm with Nginx as a proxy. Any other combinations show 403 while visiting sites. So, I had to reconfigure all sites to use such configuration. It was not good for me, because sites had special directives or Nginx settings that stopped working when using "Apache with Nginx as a proxy". I was sure that Apache and Nginx behavior would be recovered in some Plesk updates, but it not happened.

Any ideas, how to fix this misconfiguration?
Thanks.
 
Hi Nag,

you don't provide enough informations about current ".htaccess" - files and used "Additional nginx directives" for your (sub)domain, which makes it impossible to give general suggestions on how to solve your described issue(s).

In order to be able to investigate your issue(s), you should consider to provide MORE informations about the actual content at your (sub)domain(s). Best practice here is to provide as well a link to your content, so that people willing to help you have something to start with their investigations. ;)
 
The FastCGI configuration file might be corrupt, but difficult to tell what exactly is wrong with it. It is located in /etc/nginx/fastcgi.conf

Example of working file content:
Code:
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# https://httpoxy.org/
fastcgi_param  HTTP_PROXY         "";
 
Very thanks for help.
This issue doesn’t depend on ".htaccess" - files and used "Additional nginx directives". I’ve wrote about it just to say, that configuration “apache + nginx proxy” sometimes is not suitable. Some sites need clear apache.
This case is about any site on the server. Even simple site, without any directives. I’ve attached an image for better description.
The /etc/nginx/fastcgi.conf is equal with the Peter Debik example.
I found nothing criminal in /var/log/httpd/… /var/log/nginx/… and /var/www/vhosts/sitename/logs/…
Just [18/May/2017:13:22:25 +0300] "GET / HTTP/1.1" 403 564 "-" "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" in /var/www/vhosts/sitename/logs/proxy_access_log when configured any other way than “apache + nginx proxy”

Maybe I have to get a look somewhere else?
 

Attachments

  • e1.jpg
    e1.jpg
    159.2 KB · Views: 9
"Working" configuration: Looks perfectly alright. Static files are served by Nginx, dynamic (PHP) requests are forwarded to Apache and served by Apache via FPM interface. That is the recommended, default configuration. Why would anyone want to change that?

First "not working" configuration: You have configured "Nginx only" hosting. Requests are never forwarded to Apache. For that reason the "PHP FPM Apache" setting cannot work. No error, simply a configuration misunderstanding. It is the correct, expected behavior that this does not work.

Second "not working" configuration: When you enter a URL directly, e.g. mydomain.com/index.php instead of mydomain.com only, does it work in that case? So is this a directory index issue for index.php files? When you request another file, is that other file delivered? And just to make sure: Was Nginx restarted after the configuration change or at least did it reload the configuration, e.g. with
# service nginx reload
?
 
Back
Top