• 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

Apache+Nginx https redirect

Extar93

New Pleskian
Hello! There is a problem with HTTPS. Apache + Nginx PHP mode FPM. CMS: WordPress. When adding a rule redirect to https in the domain configuration file nginx.conf, everything works. But, if you add a rule in the ' Additional directive nginx ' in Plesk Panel the error when connecting to site ' TOO_MANY_REDIRECTS ' how can I fix it?
Additional directive nginx:
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}

Rule redirect
rewrite ^(.*)$ https://site.ru/$1 redirect;
 
Last edited:
If you use Apache + nginx, you don't need these additional nginx directives.

Regards
 
It will.
If you have set in php settings - phpfpm with apache and in server settings - serve static files by nginx, it should work correctly. If you have any problems, open permalink settings in WordPress and apply pretty URLs again, that will set the corect rules in htaccess.

If you set in php settings phpfpm with nginx, then you should add that if rule in additional nginx directives. In this case htaccess file will not be taken in account.
 
It will.
If you have set in php settings - phpfpm with apache and in server settings - serve static files by nginx, it should work correctly. If you have any problems, open permalink settings in WordPress and apply pretty URLs again, that will set the corect rules in htaccess.

If you set in php settings phpfpm with nginx, then you should add that if rule in additional nginx directives. In this case htaccess file will not be taken in account.
Well, thanks for the info.
 
Hi Extar93 and bulent,

If you use Apache + nginx, you don't need these additional nginx directives.
Sorry, but this is incorrect. It's not the fact that you don't NEED it, there might be already a redirection, depending to your domain settings over Plesk, so that using another redirection will cause issues as described in the starting post of this thread.

Additional directive nginx:
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}

Rule redirect
rewrite ^(.*)$ https://site.ru/$1 redirect;

BEFORE you add such an additional directives, please CHECK your current nginx.conf ( or nginx_ip_default.conf ) ( at: "/var/www/vhosts/system/YOUR-DOMAIN.COM/conf/" ) for that specific (sub)domain.
A standard example would look like this in your configuration file:
Code:
    if ($host ~* ^YOUR-DOMAIN.COM$) {
        rewrite ^(.*)$ https://www.YOUR-DOMAIN.COM$1 permanent;
    }


If you would like to use additional directives, please keep in mind, that there are very good FREE extensions for Plesk available:
  1. htaccess to nginx ( Link to the Plesk extension catalogue )
  2. Webserver Configurations Troubleshooter ( available over the Plesk Installer: "Additional Plesk extensions" )
Both extensions help to avoid configuration failures, so it is a wise idea to use them.
 
Hi Extar93 and bulent,


Sorry, but this is incorrect. It's not the fact that you don't NEED it, there might be already a redirection, depending to your domain settings over Plesk, so that using another redirection will cause issues as described in the starting post of this thread.


BEFORE you add such an additional directives, please CHECK your current nginx.conf ( or nginx_ip_default.conf ) ( at: "/var/www/vhosts/system/YOUR-DOMAIN.COM/conf/" ) for that specific (sub)domain.
A standard example would look like this in your configuration file:
Code:
    if ($host ~* ^YOUR-DOMAIN.COM$) {
        rewrite ^(.*)$ https://www.YOUR-DOMAIN.COM$1 permanent;
    }


If you would like to use additional directives, please keep in mind, that there are very good FREE extensions for Plesk available:
  1. htaccess to nginx ( Link to the Plesk extension catalogue )
  2. Webserver Configurations Troubleshooter ( available over the Plesk Installer: "Additional Plesk extensions" )
Both extensions help to avoid configuration failures, so it is a wise idea to use them.
Thank you. Everything worked.
 
Back
Top