nginx 多端口 配置 多个二级域名 无效

Posted 白马非马

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx 多端口 配置 多个二级域名 无效相关的知识,希望对你有一定的参考价值。

server {
listen 80;
#listen 443 ssl;
server_name www.lovebugs.com lovebugs.com;
#ssl on;
ssl_certificate /etc/nginx/cert/214592172780915.pem;
ssl_certificate_key /etc/nginx/cert/214592172780915.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;
ssl_prefer_server_ciphers on;
location / {

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header Host $http_host;

        proxy_pass http://localhost:9527;

proxy_redirect off;
break;

    }
    

}

server {

listen 80;
#listen 443 ssl;
server_name www.api.lovebugs.com api.lovebugs.com;
#ssl on;
ssl_certificate  /etc/nginx/cert/214592172780915.pem;
ssl_certificate_key /etc/nginx/cert/214592172780915.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;
ssl_prefer_server_ciphers on;
location / {

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header Host $http_host;

    proxy_pass http://localhost:9528;

proxy_redirect off;
break;
}
}

server {
listen 80;
#listen 443 ssl;
server_name www.manage.lovebugs.com manage.lovebugs.com;
#ssl on;
ssl_certificate /etc/nginx/cert/214592172780915.pem;
ssl_certificate_key /etc/nginx/cert/214592172780915.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;
ssl_prefer_server_ciphers on;
location / {

    proxy_set_header X-Real-IP $remote_addr;

    proxy_set_header Host $http_host;

    proxy_pass http://localhost:8080; 

proxy_redirect off;
break;

}

}

server {
listen 8080;
server_name localhost;
#ssl on;
#ssl_certificate /etc/nginx/cert/214592172780915.pem;
#ssl_certificate_key /etc/nginx/cert/214592172780915.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;
#ssl_prefer_server_ciphers on;
root /app/blog-manage/dist;
# root /usr/share/nginx/html;
index index.html index.htm;

}

以上是关于nginx 多端口 配置 多个二级域名 无效的主要内容,如果未能解决你的问题,请参考以下文章

nginx 一端口多网站代理

[Nginx]-外部多端口映射Https443端口配置

Nginx配置80端口用于多个域名

nginx配置多域名多个ssl证书

nginx 一端口多网站代理

Nginx配置——单域名反向代理多个端口