php mate,[树莓派] ubuntu-mate配置nginx + php7.0环境
樹莓派3b,系統 ubuntu-mate 16.04
1、安裝 Nginx 和 PHP7
sudo apt-get update
sudo apt-get install nginx php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-mcrypt php7.0-cgi php7.0-sqlite3 php7.0-mysql
sudo service nginx start
sudo service php7.0-fpm restart
復制代碼
2、如果安裝成功,可通過 http://樹莓派IP 訪問到 Nginx 的默認頁。Nginx 的根目錄在 /var/www/html。 進行以下操作來讓 Nginx 能處理 PHP。
sudo vi /etc/nginx/sites-available/default
復制代碼
將其中的如下內容
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
復制代碼
替換為
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
location ~\.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
復制代碼
保存之后重啟nginx
sudo service nginx restart
以上
轉載請注明原文鏈接和作者,作者:玩雙截棍的熊貓
總結
以上是生活随笔為你收集整理的php mate,[树莓派] ubuntu-mate配置nginx + php7.0环境的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ string类的常用方法_【常用
- 下一篇: php 输出可以设置格式文件,php格式