nginx下部署showdoc

玫翠慧發表於2018-08-28
  1. 安裝nginx伺服器sudo apt-get install nginx -y
  2. 啟動服務sudo service nginx start
  3. 安裝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
複製程式碼
  1. 配置nginx
  • 編輯php.conf檔案sudo vim /etc/nginx/conf.d/php.conf新增下邊內容
server {
    listen 80;
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    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;
}
複製程式碼
  1. 重新整理配置sudo service nginx reload
  2. rz命令上傳程式碼到/var/www/html
  3. 給showdoc賦許可權chmod -R 777 showdoc
  4. 訪問xx.com/showdoc/web/#/

相關文章