• 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.
  • 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.

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