侦听多个端口并将端口映射到另一个域

时间:2014-11-21 11:41:13

标签: python django nginx gunicorn

Blow是我运行nginx,gunicorn和Django的服务器的当前配置。这一切都有效。但是我添加了一些在端口5555上运行的监控应用程序。如何授予此权限?

我是否添加了另一个监听设置,我可以将其映射到另一个域吗?

upstream app_server_djangoapp {
    server localhost:8002 fail_timeout=0;
}

server {
    #EC2 instance security group must be configured to accept http connections over Port 80
    listen 80;
    server_name testdomain.com;

    access_log  /var/log/nginx/guni-access.log;
    error_log  /var/log/nginx/guni-error.log info;

    keepalive_timeout 5;

    # Size in megabytes to allow for uploads.
    client_max_body_size 20M;

    # path for static files
    root /home/username/webapps/guni/static;

    location /docs/  {
                autoindex on;
                alias /srv/site/docs/buildHTML/html/;
    }



    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://app_server_djangoapp;
            break;
        }
    }
}

1 个答案:

答案 0 :(得分:1)

这是一个基本的阻止,它会使你的.domain.tld指向监控应用程序:

server {
    listen 80;
    server_name yourdomain.tld;
    location / {
        proxy_pass http://ip-of-probably-flower-server:5555;
        }