準備:阿里云服務器,ip地址(公),實例的密碼,
1,本地連接到遠程服務器流程
1)生成密鑰,綁定到ip,重啟服務器
2)打開Xshell,新建,賬號:root,密碼:實例的密碼。導入密鑰直接鏈接
2,部署流程
https://blog.csdn.net/qq_38177305/article/details/79532023
http://www.lxweimin.com/p/03d17156616d
3,訪問http://+ip ngnix 出 bug
https://blog.csdn.net/ownfire/article/details/7966645
https://blog.csdn.net/ljfphp/article/details/78670459
https://www.cnblogs.com/iloverain/p/9428630.html
4,404 nginx重定向配置
https://blog.csdn.net/weixin_43819222/article/details/89963155
5,查看進程端口被占用
6,Hexo 部署自己的博客網站
http://www.lxweimin.com/p/5776fb872ce7
7,ssl證書(阿里云)上傳到服務器
步驟是按照阿里云文檔操作的
https://help.aliyun.com/document_detail/98728.html?spm=a2c4g.11174283.6.574.22e46fd4F6U3g9
但是中間遇到幾個問題
1)關于 nginx.conf 配置文件修改后。阿里云文檔沒有說要把#注釋符號刪除
2)關于重啟nginx的方法,使用阿里云提供的方法不行
我用的方法是:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
3)阿里云上沒有說,443端口需要手動在阿里云后臺開啟
去檢查一下你的服務器的安全組配置,看一下是否加入了443端口的鏈接,防止后面連接不上。創建的新規則如下圖。
4)配置完nginx.conf文件后重啟nginx服務器,報錯
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf 201
意思是配置文件缺少nginx依賴模塊ngx_http_ssl_module
安裝ngx_http_ssl_module模塊
我的nginx安裝目錄在:
源碼在(root根路徑下):
a,進入nginx源碼包文件
b,查看nginx原有的模塊
沒有任何模塊
c,從新配置SSL模塊
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
配置完成后,運行命令make命令:
make
d,替換已安裝好的nginx包
替換之前先備份:
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
先停止nginx服務:
//查詢nginx主進程號
$ ps -ef | grep nginx
//從容停止Nginx:
$kill -QUIT 主進程號
//快速停止Nginx:
kill -TERM 主進程號
//強制停止Nginx:
pkill -9 nginx
e,將剛剛編譯好的nginx覆蓋掉原有的nginx
cp ./objs/nginx /usr/local/nginx/sbin/
總結重啟ngnix的方法:
查看進程占用:ps -ef | grep nginx
殺死進程: kill 8899
啟動nginx: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
5),配置完后,訪問https對應的網頁,出現nginx頁面,不是上傳到服務器的網站
原因:
配置nginx.conf 文件的時候,漏掉了默認跳轉到網站
需要以下配置,location指向前端源代碼目錄
然后重新啟動nginx