If you want to optimize your site's speed, switching to FastCGI (nginx + php-fpm) can be an effective solution. This method can significantly speed up the performance of sites on various CMSs, such as Opencart, WordPress. However, in addition to the advantages, there are some nuances that are important to know about.

One of these nuances is the loss of functionality of the .htaccess file, since we are removing Apache from the bundle. If you have rules in the .htaccess file, they need to be converted using a specialized service

For example winginx.com/ru/htaccess and add them to the configuration file.

Step 1: Setup with ISPmanager 6 panel

Go to the www-domains section and select the site, change the operating mode to FastCGI (Nginx + PHP-FPM) and install the same version of PHP that is used on your site. After installation, click “OK”.



Moving the site to FastCGI (nginx + php-fpm)

Step 2: Solving 404 Error Problems

After switching to FastCGI, you will encounter the problem of 404 errors for all pages except the main one. To solve this problem, you need to register additional redirects.

In the www-domains section, select your domain and click on the “Config” button.



Depending on the CMS you use, apply the appropriate redirect settings.

Opencart add after location / {

if (!-e $request_filename){
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}


 
WordPress add after location / {

try_files $uri $uri/ /index.php?q=$uri&$args;



It is important to note that if your site uses an SSL certificate, you must specify separate redirect settings for both HTTP and HTTPS blocks.


Связанные товары