Control Web Panel

WebPanel => Apache => Nginx => Topic started by: techcomputerworld on April 01, 2020, 03:29:18 PM

Title: I want to try nginx with php-fpm but don't run wordpress, could you help me?
Post by: techcomputerworld on April 01, 2020, 03:29:18 PM
I have seen that the performance tested with all the options that apache enters and it does not go well I want to try with nginx and php-fpm but it fails me to navigate between web pages within WordPress, the issue is that I have read that it is fixed with this command and I have also seen this link and the problem does not fix it

https://forum.centos-webpanel.com/index.php?topic=6548.0
I have seen that the problem can be solved with this line but as I put it in the vhost
 location / {
                try_files $uri $uri/ /index.php?$args;
        }
when trying to put it where it does not matter it does not work for example on this site:
Code: [Select]
nano /etc/nginx/conf.d/vhosts/dominio.com.vhosts

server {
        listen 188.166.23.139:80;
        server_name quedamosencasa.com  www.quedamosencasa.com;
        root /home/brujo/public_html;
        index index.php index.html index.htm;
        access_log /usr/local/apache/domlogs/quedamosencasa.com.bytes bytes;
        access_log /usr/local/apache/domlogs/quedamosencasa.com.log combined;
        error_log /usr/local/apache/domlogs/quedamosencasa.com.error.log error;


        location / {

                location ~.*\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
                        expires max;
                }

                location ~ [^/]\.php(/|$) {
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        if (!-f $document_root$fastcgi_script_name) {
                                return  404;
                        }

                        fastcgi_pass    unix:/opt/alt/php-fpm73/usr/var/sockets/brujo.sock;
                        fastcgi_index   index.php;
                        include         /etc/nginx/fastcgi_params;
                }

        }

        location ~* "/\.(htaccess|htpasswd)$" {deny all;return 404;}

        disable_symlinks if_not_owner from=/home/brujo/public_html;

        location /.well-known/acme-challenge {
                default_type "text/plain";
                alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
        }
}
Title: Re: I want to try nginx with php-fpm but don't run wordpress, could you help me?
Post by: rcschaff on April 02, 2020, 12:58:05 AM
Don't add a second location / block, or you'll screw everything up.

Code: [Select]
server {
        listen 188.166.23.139:80;
        server_name quedamosencasa.com  www.quedamosencasa.com;
        root /home/brujo/public_html;
        index index.php index.html index.htm;
        access_log /usr/local/apache/domlogs/quedamosencasa.com.bytes bytes;
        access_log /usr/local/apache/domlogs/quedamosencasa.com.log combined;
        error_log /usr/local/apache/domlogs/quedamosencasa.com.error.log error;


        location / {
                try_files $uri $uri/ /index.php?$args;
                location ~.*\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
                        expires max;
                }

                location ~ [^/]\.php(/|$) {
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        if (!-f $document_root$fastcgi_script_name) {
                                return  404;
                        }

                        fastcgi_pass    unix:/opt/alt/php-fpm73/usr/var/sockets/brujo.sock;
                        fastcgi_index   index.php;
                        include         /etc/nginx/fastcgi_params;
                }

        }

        location ~* "/\.(htaccess|htpasswd)$" {deny all;return 404;}

        disable_symlinks if_not_owner from=/home/brujo/public_html;

        location /.well-known/acme-challenge {
                default_type "text/plain";
                alias /usr/local/apache/autossl_tmp/.well-known/acme-challenge;
        }
}