樹莓派3b安裝Nginx和php7和百度語音合成模塊


1、安裝sox系統mp3音頻播放模塊(項目需要)

sudo apt-get install lame
sudo apt-get install sox
sudo apt-get install libsox-fmt-mp3

2、安裝百度語音合成SDK(項目需要)

sudo pip install baidu-aip

3、安裝 Nginx 和 PHP7

樹莓派最新的系統(我用的版本:2018-04-18-raspbian-stretch.img)已經拋棄了對php5的支持,所以只能安裝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
sudo service nginx start
sudo service php7.0-fpm restart

如果安裝成功,可通過 http://樹莓派IP 訪問到 Nginx 的默認頁,Nginx 的根目錄在 /var/www/html。

4、Nginx默認是沒有開啟php的支持,需要進行配置

sudo nano /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; }

Ctrl + O 保存再 Ctrl + X 退出。

5、重啟服務即可

sudo service nginx restart

 

以上步驟在樹莓派3B Raspbian Stretch 系統版本上測試通過。

 

6、Pi Dashboard控制面板安裝(監控樹莓派的運行狀況)

sudo apt-get install git
cd /var/www/html
sudo git clone https://github.com/spoonysonny/pi-dashboard.git

即可通過 http://樹莓派IP/pi-dashboard 訪問部署好了的 Pi Dashboard。

同樣如果頁面無法顯示,可以嘗試在樹莓派終端給源碼添加運行權限,例如你上傳之后的路徑是 /var/www/html/pi-dashboard,則運行。

cd /var/www/html
sudo chown -R www-data pi-dashboard

 7、安裝Beautiful Soup 4

sudo pip install beautifulsoup4

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM