安裝php
apt-get install php
安裝完成後需要把php的配置加入到nginx.conf裏
首先我們需要把php-fpm的監聽端口查出來寫到nginx.conf裏:
打開php-fpm.conf配置文件查看listen
打開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