Please keep in mind that this guide only applies to the cPanel-provided NGINX package and will not work with third-party NGINX installations.
Installations of WordPress outside of WP Manager will not support Pretty Permalinks.
To resolve this issue, you must perform one of the following actions:
-
Manage your WordPress site through WP Toolkit
-
Add the following information to your NGINX configuration file, where
php73
represents the version of PHP your server runs and1ed179754201ac2644e8c70140bacb23c7786484
represents the PHP-FPM socket through which WordPress runs:
-
To obtain the correct PHP-FPM socket, run the following command where $USERNAME represents the username:
awk -F ':' '/fastcgi_pass unix/ {gsub(/;/,""); print $2}' /etc/nginx/conf.d/users/$USERNAME.conf
-
Be sure to follow the instructions in this document so Nginx does not overwrite your changes:
https://docs.cpanel.net/knowledge-base/experimental-software/nginx-standalone/#configure-a-user - Please bear in mind that NGINX configuration file in the above sentence refers to the user's config file at this location:
/etc/nginx/conf.d/users/$USERNAME.conf
- Next, you need to add this snipprt to the config file above: (/wordpress here refers where the WordPress installation is configured to be available)
location /wordpress { try_files $uri $uri/ /wordpress/index.php?$args; location ~ \.php7?$ { include conf.d/includes-optional/cpanel-fastcgi.conf; fastcgi_pass unix:/opt/cpanel/ea-php73/root/usr/var/run/php-fpm/1ed179754201ac2644e8c70140bacb23c7786484.sock; error_page 502 503 /FPM_50x.html; } }
- Finally, you restart NGINX gracefully by running this command:
/scripts/restartsrv_nginx
For more information regarding NGINX configuration in cPanel, please visit these links from our official documentation:
https://docs.cpanel.net/knowledge-base/experimental-software/nginx-standalone
https://docs.cpanel.net/knowledge-base/experimental-software/nginx-with-reverse-proxy/