最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

nginx多域名及https配置全過(guò)程(Tomcat服務(wù)器)

 更新時(shí)間:2026年07月25日 10:13:13   作者:Mr.caesar  
在配置主域名和二級(jí)域名HTTPS時(shí),你是否也遇到過(guò)證書(shū)不生效的問(wèn)題?本文分享個(gè)人實(shí)戰(zhàn)經(jīng)驗(yàn):每個(gè)域名都需要單獨(dú)申請(qǐng)并下載Nginx格式的HTTPS證書(shū),主域名配置后二級(jí)域名不會(huì)默認(rèn)啟用HTTPS,希望這份總結(jié)能幫你少走彎路,順利搞定多域名HTTPS部署

主域名配置

二級(jí)域名配置

詳細(xì)配置

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    gzip  on;

    server {
      #  listen       80;
       # server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
		

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    
	# 主域名配置
	server {
        listen 80;
        server_name 主域名;
        index index.html;
        location / {
			proxy_pass http://127.0.0.1:8080;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		}
		
    }
	
	# 二級(jí)域名配置
	server {
        listen 80;
        server_name 二級(jí)域名;
        index index.html;
        location / {
			proxy_pass http://127.0.0.1:8081;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		}
    }
  	
  	# 主域名https配置
    server {
        listen         443 ssl;
        server_name  主域名;  #網(wǎng)站域名,和80端口保持一致
        ssl             on;
        ssl_certificate E:\2846761.pem;       #證書(shū)公鑰
        ssl_certificate_key  E:\2846761.key;  #證書(shū)私鑰
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
        ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!3DES:!aNULL:!eNULL;
        ssl_prefer_server_ciphers  on;
        location / {
            proxy_pass http://www.bjjkkj.com;
            proxy_redirect  off;     
            proxy_set_header        Host    $http_host;     
            proxy_set_header        X-Real-IP       $remote_addr;     
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;     
            proxy_set_header   Cookie $http_cookie;
            #proxy_cookie_path
            chunked_transfer_encoding       off;
        }
    }
	
	# 二級(jí)域名https配置
	server {
        listen         443 ssl;
        server_name  二級(jí)域名;  #網(wǎng)站域名,和80端口保持一致
        ssl             on;
        ssl_certificate E:\1684324.pem;       #證書(shū)公鑰
        ssl_certificate_key  E:1684324.key;  #證書(shū)私鑰
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
        ssl_ciphers ECDH:AESGCM:HIGH:!RC4:!DH:!MD5:!3DES:!aNULL:!eNULL;
        ssl_prefer_server_ciphers  on;
        location / {
            proxy_pass http://i.bjjkkj.com;
            proxy_redirect  off;     
            proxy_set_header        Host    $http_host;     
            proxy_set_header        X-Real-IP       $remote_addr;     
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;     
            proxy_set_header   Cookie $http_cookie;
            #proxy_cookie_path
            chunked_transfer_encoding       off;
        }
    }
	
	server {
		listen         80;
		server_name    主域名;
		return         301 https://$server_name$request_uri;
	}

	server {
		listen         80;
		server_name    二級(jí)域名;
		return         301 https://$server_name$request_uri;
	}
}

注:

  • 查資料的過(guò)程中,有些資料說(shuō)主域名配置https之后,二級(jí)域名會(huì)默認(rèn)為https,配置過(guò)程中始終沒(méi)有配置成功,目前使用的是一個(gè)域名對(duì)應(yīng)一條https證書(shū)。
  • 域名配置https時(shí),需下載nginx的證書(shū),且每個(gè)域名都會(huì)對(duì)應(yīng)一套證書(shū)

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • nginx配置ipv6支持的實(shí)現(xiàn)示例

    nginx配置ipv6支持的實(shí)現(xiàn)示例

    本文主要介紹了nginx配置ipv6支持的實(shí)現(xiàn)示例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2025-12-12
  • 舉例詳解Tomcat與Nginx、Apache的區(qū)別是什么

    舉例詳解Tomcat與Nginx、Apache的區(qū)別是什么

    Nginx和Apache都是廣泛使用的Web服務(wù)器軟件,它們各自具有獨(dú)特的特點(diǎn)和優(yōu)勢(shì),適用于不同的應(yīng)用場(chǎng)景,下面這篇文章主要介紹了Tomcat與Nginx、Apache區(qū)別是什么的相關(guān)資料,文中通過(guò)代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2026-03-03
  • nginx?location指令(匹配順序匹配沖突)實(shí)戰(zhàn)示例詳解

    nginx?location指令(匹配順序匹配沖突)實(shí)戰(zhàn)示例詳解

    這篇文章主要介紹了nginx?location指令(實(shí)戰(zhàn)示例匹配順序匹配沖突)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • nginx 老網(wǎng)站域名重定向到新網(wǎng)站的方法(親測(cè))

    nginx 老網(wǎng)站域名重定向到新網(wǎng)站的方法(親測(cè))

    本文主要介紹了nginx 老網(wǎng)站域名重定向到新網(wǎng)站的方法,以減少業(yè)務(wù)影響并確保流量導(dǎo)向新域名,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2025-02-02
  • 詳解Nginx虛擬主機(jī)配置中server_name的具體寫(xiě)法

    詳解Nginx虛擬主機(jī)配置中server_name的具體寫(xiě)法

    這篇文章主要介紹了Nginx虛擬主機(jī)配置中server_name的具體寫(xiě)法,server_name服務(wù)器名是虛擬主機(jī)中必須配置的重要參數(shù),需要的朋友可以參考下
    2016-03-03
  • 配置Nginx的防盜鏈的操作方法

    配置Nginx的防盜鏈的操作方法

    這篇文章主要介紹了配置Nginx的防盜鏈的操作方法,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-05-05
  • Nginx反向代理+DNS輪詢+IIS7.5 千萬(wàn)PV 百萬(wàn)IP 雙線 網(wǎng)站架構(gòu)案例

    Nginx反向代理+DNS輪詢+IIS7.5 千萬(wàn)PV 百萬(wàn)IP 雙線 網(wǎng)站架構(gòu)案例

    某公司有一站點(diǎn),一天IP 430W,PV 3100W,之前采用5臺(tái) DELL R610 做NLB,系統(tǒng)2008 IIS7.5.每天高峰期時(shí)都不堪重負(fù).會(huì)出現(xiàn)以下情況
    2012-11-11
  • Nginx解決history模式下頁(yè)面刷新404問(wèn)題示例

    Nginx解決history模式下頁(yè)面刷新404問(wèn)題示例

    這篇文章主要為大家介紹了Nginx解決history模式下頁(yè)面刷新404問(wèn)題示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-10-10
  • nginx+ingress 413問(wèn)題排查過(guò)程

    nginx+ingress 413問(wèn)題排查過(guò)程

    處理413錯(cuò)誤需調(diào)整Nginx的client_max_body_size及Ingress配置,合理設(shè)置body-size,若無(wú)效,檢查后端限制,注意過(guò)大可能影響安全
    2025-08-08
  • Nginx(Tengine)啟用 SPDY 支持的配置方法

    Nginx(Tengine)啟用 SPDY 支持的配置方法

    當(dāng)老邁的 HTTP 協(xié)議逐漸不能滿足人們需求的時(shí)候,Google 的 SPDY 協(xié)議出現(xiàn)在面前,那么這個(gè)長(zhǎng)期以來(lái)一直被認(rèn)為是 HTTP 2.0 唯一可行選擇的 SPDY 是什么呢?當(dāng)下我們?nèi)绾文懿渴鹕?SPDY 呢
    2014-12-12

最新評(píng)論

浙江省| 远安县| 富顺县| 永福县| 礼泉县| 德安县| 河东区| 黎川县| 萨嘎县| 甘洛县| 亚东县| 革吉县| 平乐县| 江门市| 通山县| 庐江县| 依安县| 拜泉县| 澳门| 丽水市| 花莲市| 牙克石市| 吉水县| 修武县| 新巴尔虎左旗| 马公市| 奈曼旗| 抚松县| 正定县| 邻水| 弋阳县| 扎鲁特旗| 古交市| 舟曲县| 会理县| 连云港市| 甘孜| 宜阳县| 华池县| 嘉荫县| 和平县|