安装php

apt-get install php

 

 

 

 

安装完成后需要把php的配置加入到nginx.conf里

首先我们需要把php-fpm的监听端口查出来写到nginx.conf里:

打开php-fpm.conf配置文件查看listen

ubuntu里安装php,并配置nginx请求php-fpm

 

打开nginx.conf配置文件:

需要把nginx的用户改为 user:www-data

我的这个是;/run/php/php7.0-fpm.sock      ;应该写:

        location ~ \.php$ {

                fastcgi_pass unix:/run/php/php7.0-fpm.sock;

                fastcgi_index index.php;

                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                include fastcgi_params;

        }

有的端口号为:127.0.0.1:9000:

  location ~ \.php$ {

                fastcgi_pass 127.0.0.1:9000;

                fastcgi_index index.php;

                fastcgi_param APPLICATION_ENV production;

                include fastcgi_params;

        }

修改完成后:重启nginx和php-fpm重新查看网址就OK

相关文章:

  • 2021-06-10
  • 2022-12-23
  • 2021-11-22
  • 2021-08-25
  • 2021-07-27
  • 2022-12-23
  • 2022-02-04
  • 2021-12-27
猜你喜欢
  • 2021-12-24
  • 2021-08-29
  • 2021-08-24
  • 2022-02-22
相关资源
相似解决方案