- 安裝nginx伺服器
sudo apt-get install nginx -y
- 啟動服務
sudo service nginx start
- 安裝php環境
sudo apt-get install -y php7.1 php7.1-fpm php7.1-gd php7.1-mcrypt php7.1-mbstring php7.1-mysql php7.1-pdo php7.1-sqlite
複製程式碼
- 配置nginx
- 編輯php.conf檔案
sudo vim /etc/nginx/conf.d/php.conf
新增下邊內容
server {
listen 80;
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
複製程式碼
- 編輯default檔案
vim /etc/nginx/sites-available/default
去掉下邊這個配置的註解
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
}
複製程式碼
- 重新整理配置
sudo service nginx reload
rz
命令上傳程式碼到/var/www/html
- 給showdoc賦許可權
chmod -R 777 showdoc
- 訪問
xx.com/showdoc/web/#/