nginx反向代理具有不同证书的多个子域

nginx反向代理具有不同证书的多个子域

因此,我最终将我的 Nginx 设置为充当反向代理,但是我该如何为服务器框 2 设置 manager.domain 呢?

示例 panel.spiral 转到服务器 1 manager.spiral 转到服务器 2

每个服务器/域使用单独的证书

下面是我的代理配置的帖子编辑:新配置还不转发流量?

server {
    listen 80;
    return 301 https://$host$request_uri;
}

server {

    listen 443 ssl;
    server_name panel.spiralcrafters.com;

    # SSL Configuration
    ssl_certificate  /etc/letsencrypt/live/panel.spiralcrafters.com-0001/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/panel.spiralcrafters.com-0001/privkey.pem;
    ssl_session_cache shared:SSL:10m;
    ssl_protocols TLSv1.2;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/jenkins.access.log;

    location / {

      proxy_set_header        Host $host;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header        X-Forwarded-Proto $scheme;

      # Fix the It appears that your reverse proxy set up is broken" error.
      proxy_pass          http://localhost:8080;
      proxy_read_timeout  90;

      proxy_redirect      http://localhost:8080 https://panel.spiralcrafters.com;
    }
  }

  server {

      listen 443 ssl;
      server_name manager.spiralcrafters.com;

      # SSL Configuration
      ssl_certificate   /etc/letsencrypt/live/manager.spiralcrafters.com/fullchain.pem;
      ssl_certificate_key   /etc/letsencrypt/live/manager.spiralcrafters.com/privkey.pem;
      ssl_session_cache shared:SSL:10m;
      ssl_protocols TLSv1.2;
      ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
      ssl_prefer_server_ciphers on;

      access_log            /var/log/nginx/manager.access.log;

      location / {

        proxy_set_header        Host $host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;

        # Fix the It appears that your reverse proxy set up is broken" error.
        proxy_pass          http://192.168.1.87:880;
        proxy_read_timeout  90;

        proxy_redirect      http://192.168.1.87:880 https://manager.spiralcrafters.com;
      }
    }

相关内容