天天看點

樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

安裝 nginx + php環境

安裝nginx和php全家桶,使用下面指令:

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-mbstring
           
樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

部署可道雲kodexplorer

建立www檔案夾,來存放網站内容:

mkdir www && cd www    
wget static.kodcloud.com/update/download/kodexplorer4.37.zip
unzip kodexplorer4.37.zip && rm kodexplorer4.37.zip
           
樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

簡單配置

對nginx設定pi權限:

sudo nano /etc/nginx/nginx.conf
           

Ctrl+O儲存,Ctrl+X退出。

樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

對php設定pi權限:

sudo nano /etc/php/7.0/fpm/pool.d/www.conf
           

同樣将 www-data 更改為 pi ,

樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

配置網站:

sudo nano /etc/nginx/sites-(删除我)available/default
           

将下面代碼粘貼進去

server {        
    listen 80 default_server;        
    listen [::]:80 default_server;       
    root /home/pi/www;        
    server_name _;
    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; 
    } 
}
           
listen [::]:80 default_server;                  
樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境

重新開機nginx:

sudo service nginx restart
           

打開樹莓派ip位址,80端口,

http://

樹莓派位址:80,如下設定登入密碼即可。

樹莓派用上kodexplorer也能玩成私有網盤安裝 nginx + php環境