国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

Nginx從搭建到配置支持HTTPS的方法

2024-08-30 12:24:56
字體:
來源:轉載
供稿:網友

安裝

基礎包

ububtuapt-get install build-essentialapt-get install libtoolcentosyum -y install gcc automake autoconf libtool makeyum install gcc gcc-c++

進入安裝目錄

cd /usr/local/src

安裝 PCRE 支持正則表達 使 Nginx 支持 Rewrite 功能

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gztar -zxvf pcre-8.42.tar.gzcd pcre-8.42./configuremakemake install

安裝 zlib 支持數據壓縮

wget http://zlib.net/zlib-1.2.11.tar.gztar -zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configuremakemake install

安裝 openssl 支持 https

wget https://www.openssl.org/source/openssl-1.1.1-pre7.tar.gztar -zxvf openssl-1.1.1-pre7.tar.gzcd openssl-1.1.1-pre7./configuremakemake install

Nginx

wget http://nginx.org/download/nginx-1.14.0.tar.gztar -zxvf nginx-1.14.0.tar.gzcd nginx-1.14.0./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modulemakemake install

配置

配置文件地址

/usr/local/nginx/conf/nginx.conf

使用

命令

/usr/local/nginx/sbin/nginx           # 啟動 Nginx/usr/local/nginx/sbin/nginx -t          # 檢查 Nginx 配置文件正確性/usr/local/nginx/sbin/nginx -s reload      # 重新載入配置文件/usr/local/nginx/sbin/nginx -s reopen      # 重啟 Nginx/usr/local/nginx/sbin/nginx -s stop       # 停止 Nginx

進程關閉

# 查看進程號ps -ef|grep nginx# 正常退出kill -QUIT 進程號# 快速停止kill -TERM 進程號kill -INT 進程號# 強制退出kill -KILL nginx生成 cer 證書支持 https生成 cer 證書# 進入存放證書的目錄/usr/local/nginx/conf/ssl# 創建服務器證書密鑰文件 server.key 私鑰openssl genrsa -des3 -out server.key 1024# 輸入密碼,確認密碼,后面會使用# 創建簽名請求的證書(CSR)openssl req -new -key server.key -out server.csr# 輸出內容為:# Enter pass phrase for root.key: ← 輸入前面創建的密碼 # Country Name (2 letter code) [AU]:CN ← 國家代號,中國輸入CN# State or Province Name (full name) [Some-State]:BeiJing ← 省的全名,拼音# Locality Name (eg, city) []:BeiJing ← 市的全名,拼音# Organization Name (eg, company) [Internet Widgits Pty Ltd]:MyCompany Corp. ← 公司英文名# Organizational Unit Name (eg, section) []: ← 可以不輸入# Common Name (eg, YOUR name) []: ← 此時不輸入# Email Address []:admin@mycompany.com ← 電子郵箱,可隨意填# Please enter the following ‘extra' attributes# to be sent with your certificate request# A challenge password []: ← 可以不輸入# An optional company name []: ← 可以不輸入# 備份服務器密鑰文件cp server.key server.key.org# 去除文件口令,生成公鑰openssl rsa -in server.key.org -out server.key# Enter pass phrase for server.key.org: ← 輸入前面創建的密碼# 生成證書文件 server.crtopenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汕头市| 新营市| 定安县| 昭通市| 阳西县| 乳山市| 广宗县| 曲周县| 孟津县| 怀集县| 阳信县| 孝昌县| 水富县| 旺苍县| 沅陵县| 柏乡县| 获嘉县| 莲花县| 信宜市| 兴义市| 卢氏县| 定日县| 新宁县| 壤塘县| 西和县| 舞钢市| 开阳县| 咸宁市| 万年县| 安阳县| 陵水| 荥经县| 新蔡县| 萨嘎县| 盘山县| 银川市| 永仁县| 渝中区| 榆中县| 高台县| 潼南县|