1、准備Web項目資源包
2、在CentOS服務器上創建存放項目的相關目錄
$ cd /home/
$ mkdir toutiao
3、通過終端sftp,將Web資源包上傳到,/home/toutiao/
sftp -P 端口 用戶@服務器IP 示例: sftp -P 8081 user@192.168.20.249
>sftp cd /home/toutiao/
>sftp put /路徑/案例一.zip
4、通過終端命令,解壓上傳到服務器上資源包
cd /home/toutiao/
unzip 案例一
解壓包如下:
5、配置Nginx,在etc/nginx/conf.d/目錄下修改 nginx.conf配置
6、修改/etc/selinux/config目錄下SELINUX的狀態,
將SELINUX=enforcing 修改為 SELINUX=disabled 狀態
vi /etc/selinux/config #SELINUX=enforcing SELINUX=disabled
重啟生效。reboot。
7、重啟nginx
$ sudo systemctl enable nginx # 設置開機啟動
$ sudo service nginx start # 啟動 nginx 服務
$ sudo service nginx stop # 停止 nginx 服務
$ sudo service nginx restart # 重啟 nginx 服務
$ sudo service nginx reload # 重新加載配置,一般是在修改過 nginx 配置文件時使用。
8、測試,在瀏覽器上輸入ip地址,進行測試。