Want to subscribe to topics you're interested in?
Become a Member

PHP-FPM Nginx PHP-FPM configuration

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by dce, Jun 26, 2019 at 9:55 AM.

  1. dce

    dce New Member

    4
    3
    3
    Feb 21, 2018
    Ratings:
    +3
    Local Time:
    4:48 PM
    Hello,
    I am setting up October CMS on Centmin.

    How do I get the nginx config example below working with centmin mod? It causes the Nginx to fail to restart.

    location ~ \.php$ {
    include default.d/php.conf;
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm/www.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 120s;
    }

    The strange thing is that I can get October cms to run with just:
    location / {
    rewrite ^/.*$ /index.php last;
    }

    Why would PHP scripts work with Nginx if I have not yet done any configuration to pass
    PHP scripts to the FastCGI server? How is PHP being processed by Nginx when I don't have fastcgi_pass / fastcgi_param configured? I am a little confused!

    Thanks
     
  2. eva2000

    eva2000 Administrator Staff Member

    40,322
    8,930
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,753
    Local Time:
    6:48 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you can remove
    Code (Text):
    location ~ \.php$ {
    include default.d/php.conf;
    include fastcgi_params;
    fastcgi_pass unix:/run/php-fpm/[URL='http://www.sock%3B/']www.sock;[/URL]
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 120s;
    }

    each centmin.sh menu generated nginx vhost has an include file which is global
    Code (Text):
    include /usr/local/nginx/conf/php.conf;
    

    which covers serving php files
     
  3. dce

    dce New Member

    4
    3
    3
    Feb 21, 2018
    Ratings:
    +3
    Local Time:
    4:48 PM
    Thanks for the quick reply which clarified things. Took a look at the global config and saw dft_php which I tracked down out of curiosity!
     
    • Like Like x 1
  4. eva2000

    eva2000 Administrator Staff Member

    40,322
    8,930
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,753
    Local Time:
    6:48 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    You're welcome :)
     
..