如何在nginx中添加多个ip以及添加子域名?

如何在nginx中添加多个ip以及添加子域名?

我按照 nginx、uwsgi 与 flask 和 docker 教程操作。我的 nginx 配置文件包含:

server {

listen 5000;
server_name 19X.X.X.X;

client_header_buffer_size 5M;
large_client_header_buffers 4 5M;
client_max_body_size 75M;

location / {
    include uwsgi_params;     
    uwsgi_pass flask:8080;
   }
}

在这里我想添加一个额外的 IP 地址,例如123.345.67.8和一个子域名测试.mydomain.com。我怎样才能添加到那里?

编辑2:


server {

listen 1.1.1.1:5000 default_server;
server_name localhost;

client_header_buffer_size 5M;
large_client_header_buffers 4 5M;
client_max_body_size 75M;

location / {
    include uwsgi_params;     
    uwsgi_pass flask:8080;
   }
}


server {

listen 2.2.2.2:5000 default_server;
server_name test.mydomain.com;

client_header_buffer_size 5M;
large_client_header_buffers 4 5M;
client_max_body_size 75M;

location / {
    include uwsgi_params;     
    uwsgi_pass flask:8080;
   }
}

相关内容