Author Topic: I want to try nginx with php-fpm but don't run wordpress, could you help me?  (Read 5861 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
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;
        }
}

Offline
****
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;
        }
}
Google Hangouts:  rcschaff82@gmail.com