//要安裝php 參考 https://blog.csdn.net/qq_35590198/article/details/100659154
$ sudo vim /etc/nginx/sites-enabled/default
//配置參考,分爲2個部分,第一個是index行要添加index.php,如下:
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
//第二個是要刪除 pass PHP scripts to FastCGI server 中的幾行註釋,如下:
# pass PHP scripts to FastCGI server#
location ~ \.php$ {
include snippets/fastcgi-php.conf;# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;# # With php-cgi (or other tcp sockets):# fastcgi_pass 127.0.0.1:9000;}
//保存退出
$ sudo systemctl restart nginx.service //重啓Nginx
//
$ sudonano /var/www/html/phpinfo.php //添加phpinfo文件,寫入如下內容
<?php
phpinfo();
?>
//瀏覽器輸入ip/phpinfo.php測試,顯示php內容即正常
http://raspbian_ip/phpinfo.php