Introduction
When using Nginx Standalone, some additional configuration is required to get it working properly with WordPress Permalinks. Please note that this only applies to the Nginx Standalone package, not the Nginx with Reverse Proxy package. Additionally, this can only be done with WordPress installations managed from within WP Toolkit.
Procedure
You will need to obtain the path to the user's PHP socket file and add it to the user's Nginx configuration file:
- Access your server using SSH as the root user
- Run the following command to get the path to your PHP socket files for the user, replacing "$USERNAME" with the cPanel username to get your PHP paths:
awk -F ':' '/fastcgi_pass unix/ {gsub(/;/,""); print $2}' /etc/nginx/conf.d/users/$USERNAME.conf - Using a text editor, open the user's configuration file for Nginx standalone at the following path:
/etc/nginx/conf.d/users/$USERNAME.conf - Add the following configuration to this file. The "$WPPATH" entry will be replaced with the installation path of the WordPress blog relative to the user's public_html folder. The "$SOCKPATH" entry is replaced by the socket path you obtained above.
location /$WPPATH { try_files $uri $uri/ /wordpress/index.php?$args; location ~ \.php7?$ { include conf.d/includes-optional/cpanel-fastcgi.conf; fastcgi_pass unix:$SOCKPATH error_page 502 503 /FPM_50x.html; } } - Save the file in your text editor, and restart Nginx to commit the changes:
/scripts/restartsrv_nginx
Additional Resources
For more information regarding Nginx Standalone configuration in cPanel, please visit our official documentation:
Comments
0 comments
Article is closed for comments.