nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn)
更新時間:2020年09月06日 16:23:56 作者:詩水人間
這篇文章主要介紹了nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
nginx.conf配置文件如下
user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; # 以下屬性中以ssl開頭的屬性代表與證書配置有關(guān),其他屬性請根據(jù)自己的需要進(jìn)行配置。 server { listen 443 ssl; #SSL協(xié)議訪問端口號為443。此處如未添加ssl,可能會造成Nginx無法啟動。 server_name localhost; #將localhost修改為您證書綁定的域名,例如:www.example.com。 root html; index index.html index.htm; ssl_certificate /etc/nginx/huashengshu.top.pem; #替換成您證書的文件名。 ssl_certificate_key /etc/nginx/huashengshu.top.key; #替換成您證書的密鑰文件名。 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用該協(xié)議進(jìn)行配置。 ssl_prefer_server_ciphers on; location / { root /etc/nginx/hss; #站點(diǎn)目錄。 index index.html index.htm; } } server { listen 80; server_name huashengshu.top; rewrite ^(.*)$ https://${server_name}$1 permanent; } }
起作用的是
server { listen 80; server_name huashengshu.top; rewrite ^(.*)$ https://${server_name}$1 permanent; }
到此這篇關(guān)于nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn)的文章就介紹到這了,更多相關(guān)nginx 代理80轉(zhuǎn)443內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Nginx中虛擬主機(jī)與指定訪問路徑的設(shè)置方法講解
這篇文章主要介紹了Nginx中虛擬主機(jī)與指定訪問路徑的設(shè)置方法講解,也是在同一個Nginx程序中部署多個站點(diǎn)的基本方法,需要的朋友可以參考下2016-03-03使用Nginx實(shí)現(xiàn)服務(wù)器中多容器共存的方法
這篇文章主要介紹了使用Nginx實(shí)現(xiàn)服務(wù)器中多容器共存的方法,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2018-10-10nginx臨時搭建rtmp服務(wù)器的方法實(shí)現(xiàn)
nginx是一款優(yōu)秀的反向代理工具,通過Nginx自帶的rtmp模塊,也可以實(shí)現(xiàn)rtmp服務(wù)器的搭建,本文主要介紹了nginx臨時搭建rtmp服務(wù)器,具有一定的參考價值,感興趣的可以了解一下2024-02-02