反向代理nginx重定向多个网站

反向代理nginx重定向多个网站

我似乎遇到了问题,所以我有一个反向代理,它向我的 git 执行了代理传递,现在我想添加我的投资组合。我做的第一件事是创建一个新的配置 portfolio.conf 并执行代理传递。由于这已经出错了,我尝试将其放入相同的配置中,并将代理传递更改为代理重定向,但问题相同。

目前,投资组合重定向到我的 git 服务器,并且您会获得一个证书错误域名。

什么问题?

配置:

    server {
    listen 443 ssl;
    listen [::]:443 ssl;

    #listen 80;
    #listen [::]:80;

    server_name git.timclinckemalie.me

    ssl_certificate /etc/letsencrypt/git.timclinckemalie.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/git.timclinckemalie.me/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    #ssl_prefer_server_ciphers on;
    #ssl_session_cache shared:SSL:10m;
    ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256$

    location / {
        proxy_redirect  http://192.168.0.68;
    }
}


server {
    listen 443 ssl;
    listen [::]:443 ssl;

    #listen 80;
    #listen [::]:80;

    server_name portfolio.timclinckemalie.me

    ssl_certificate /etc/letsencrypt/portfolio.timclinckemalie.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/portfolio.timclinckemalie.me/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    #ssl_prefer_server_ciphers on;
    #ssl_session_cache shared:SSL:10m;
    ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256$

    location / {
        proxy_redirect http://192.168.0.83:5104;
    }
}

编辑:

更改了配置reverseproxy.conf<-我已经有这个了:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    #listen 80;
    #listen [::]:80;

    server_name git.timclinckemalie.me

    ssl_certificate /etc/letsencrypt/git.timclinckemalie.me/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/git.timclinckemalie.me/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    #ssl_prefer_server_ciphers on;
    #ssl_session_cache shared:SSL:10m;
    ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256$

    location / {
        proxy_pass  http://192.168.0.68;
    }
}

新的投资组合配置:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    listen 80;
    listen [::]:80;

    server_name portfolio.timclinckemalie.me

    ssl_certificate /etc/letsencrypt/portfolio.timclinckemalie.me-001/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/portfolio.timclinckemalie.me-001/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    #ssl_prefer_server_ciphers on;
    #ssl_session_cache shared:SSL:10m;
    ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA25$

    location / {
        proxy_pass http://192.168.0.83:5104;
    }
}

当我询问证书时的结果:

证书

编辑2:

因此,使用 edit1 的当前配置,我尝试通过使用 http 访问我的域来绕过我的证书,但是我得到了 404not found,我想这解释了第一件事。

编辑3:我已经找到了一半的解决方案,我必须在 /etc/nginx/config.d 中的配置中添加一个服务器块条目,然后请求一个新的证书,并且它完美地工作了,但是我现在得到了一个 502 错误网关 :(

相关内容