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

Nginx plesk issues - Wordpress permalinks

Xavier12

Regular Pleskian
Hey guys,

It seems we are receiving a 404 Nginx error for a Wordpress website when setting up custom permalinks. We've tried entering the following directive for the website

location / {
try_files $uri $uri/ /index.php?$args;
}

This is the error that we receive:
/var/www/vhosts/system/mydomain.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf

We've also tried the following:
• Restarting nginx and apache several times
• Using webserver configuration troubleshooter and repaired all multiple times.
• Going into the Wordpress dashboard and saving the default permlinks, then changing to the custom permalinks.

Still the issue persists and pages do not work. It displays NGINX 404 error

Please advise, thanks.
 
Hi Xavier12,

custom permalinks need custom redirects ( as you will always define them for the apache webserver in a ".htaccess" - file, you have to define the redirects for nginx as well ).
There is a wonderfull extension for Plesk, called "htaccess to nginx" - it will help you to convert your htaccess - rewrite rules to nginx rewrite rules automatically.

1.png


Please install this extension over your Plesk Control Panel ( => Extensions ) and respond with your results afterwards. ^^
 
Hi UFHH01,

Tried it, and this is the error that I am getting:

This webpage has a redirect loop


ERR_TOO_MANY_REDIRECTS

Here is the converted .htaccess that appeared after

#ignored: "-" thing used or unknown variable in regex/rew
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite /. /index.php last;
}
 
Hi Xavier12,

Here is the converted .htaccess that appeared after

#ignored: "-" thing used or unknown variable in regex/rew
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite /. /index.php last;
}

Please post as well your .htaccess - file, for further investigations!

Please keep as well in mind, that log - files ( domain specific apache, nginx log - files ) and configuration files can help to investigate issues and because you use wordpress, it is as well a good idea to provide the wordpress version and the used plugins. Did you try to disable the plugins and re-enable them one-by-one, to see if not a plugin is the cause of the issue?
What have you done, before the issue occured? Or is this a fresh wordpress installation?

The more information you provide, the better ( exacter ) will be the suggestions, as you already know by now. ^^
 
Hi UFHH01,

The issue has been solved. Not sure what the issue was, but we used a default wp-config.php file and entered the database info, wp prefix and salt info. Also disabled all plugins and re-enabled each one.. It seems this may have fixed the Nginx permalinks issue.

Thank you very much! :)
 
Back
Top