nginx搭建https+http2
生活随笔
收集整理的這篇文章主要介紹了
nginx搭建https+http2
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
建站服務器
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1a.tar.gz
tar zxvf OpenSSL_1_1_1a.tar.gz
cd nginx-1.15.8/
#通過--with-http_v2_module 打包http2 --with-openssl指定openssl目錄
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_v2_module --with-openssl=../openssl-OpenSSL_1_1_1a
make -j2
sudo make install
#最后在nginx conf server下配置
listen 443 ssl http2;
server_name localhost;
ssl_certificate_key /home/anfang/Downloads/cert/key.pem;
ssl_certificate /home/anfang/Downloads/cert/cert.pem;
openssl genrsa -out key.pem 2048
openssl req -new -x509 -sha256 -key key.pem \\
-out cert.pem -days 36500 \\
-subj /C=CN/ST=Shanghai/L=Songjiang/O=ztgame/OU=tech/CN=mydomain.ztgame.com/emailAddress=myname@ztgame.com
openssl x509 -in cert.pem -noout -text
總結
以上是生活随笔為你收集整理的nginx搭建https+http2的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获取磁盘SN、槽位相关信息
- 下一篇: linux安装gcc命令是什么