树莓派nginx无法安装mysql_在树莓派上安装 Nginx + PHP

修改 Nginx 的配置文件

找到如下内容

# Add index.php to the list if you are using PHP

index index.html index.htm index.nginx-debian.html;

根据注释的说明,加上 index.php 来更好地支持 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

#

#location ~ \.php$ {

# include snippets/fastcgi-php.conf;

#

# # With php-fpm (or other unix sockets):

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

# # With php-cgi (or other tcp sockets):

# fastcgi_pass 127.0.0.1:9000;

#}

这部分的内容是选择当遇到 php 脚本时应该如何处理

由于刚刚安装的是 php-fpm ,所以去掉部分注释即可

修改后(注意整块内容的完整,不要缺少了大括号)

# pass PHP scripts to FastCGI server

#

location ~ \.php$ {

include snippets/fastcgi-php.conf;

#

# # With php-fpm (or other unix sockets):

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

# # With php-cgi (or other tcp sockets):

# fastcgi_pass 127.0.0.1:9000;

}

也可以选择删除多余内容,只保留如下内容

location ~ \.php$ {

include snippets/fastcgi-php.conf;

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

}

修改完毕,重启 Nginx 服务

systemctl restart nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值