#nginx配置php(Thinkphp)的那些坑

最近想在nginx配置php,发现网上大多教程的不行,后来发现原来是要php5.6及以上版本,而且还要安装php-fpm
下面是我的nginx的配置文件

location ~ \.php$ {
        root           /usr/share/nginx/html; #/usr/share/nginx/html这个路径是放php文件的,比如我新建了一个叫text.php的文件就放在这里
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

test.php代码如下:

<?php
        phpinfo();
?>

效果如下图:
linux nginx配置php(Thinkphp)
记得启动php-fpm
记得启动php-fpm
记得启动php-fpm
记得启动php-fpm
记得重启nginx
记得重启nginx
记得重启nginx
记得重启nginx

相关文章:

  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-07-22
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
猜你喜欢
  • 2022-01-31
  • 2021-09-08
  • 2022-12-23
  • 2021-07-30
  • 2021-12-22
  • 2022-12-23
相关资源
相似解决方案