600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 树莓派配置php环境变量 树莓派PHP环境配置 解决页面空白

树莓派配置php环境变量 树莓派PHP环境配置 解决页面空白

时间:2020-09-23 00:06:31

相关推荐

树莓派配置php环境变量 树莓派PHP环境配置 解决页面空白

网上相关教程很多,这里就不细述了,主要是在安装完成后会出现页面空白,无法正常解析php。

1、安装php环境:

sudo apt-get install nginx php5-fpm php5-cgi php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-memcache php5-gd php5-sqlite php5-cgi php5-xmlrpc mysql-server mysql-client

如果不需要mysql环境,去掉最后两个mysql-server mysql-client

2、修改站点配置文件:

sudo nano /etc/nginx/sites-available/default

修改为以下内容:

server {

listen 80;

server_name ;

root /var/www/;

access_log /var/log/nginx/localhost.access.log;

#error_page 404 /404.html;

if (!-e $request_filename)

{

rewrite ^(.*)$ /index.php$1 last;

}

location / {

index index.html index.htm index.php default.html default.htm default.php;

}

location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {

access_log off;

expires 1d;

}

location ~ .*\.php(\/.*)*$ {

fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}

需要说明的是,站点目录为/var/www/,重点关注这一句:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

如果少了就加上。

原文:/ghostcat/p/5494451.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。