2014-09-25 225 views
0

我試圖把這個supervisord + nginx +龍捲風設置工作。由於Tornado文件可通過IP:8000和IP:80向我顯示'Welcome to nginx',所以我認爲可能是我的nginx.conf包含錯誤。我的目標是讓這個救我的龍捲風現場用戶在端口80nginx +龍捲風+ supervisord

nginx.conf如下:

user nginx; 
worker_processes 1; 

error_log /var/log/nginx/error.log; 
pid /var/run/nginx.pid; 

events { 
    worker_connections 1024; 
    use epoll; 
} 

http { 
    # Enumerate all the Tornado servers here 
    upstream frontends { 
     server 127.0.0.1:8000; 
     server 127.0.0.1:8001; 
     server 127.0.0.1:8002; 
     server 127.0.0.1:8003; 
    } 

    include /etc/nginx/mime.types; 
    default_type application/octet-stream; 

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

    keepalive_timeout 65; 
    proxy_read_timeout 200; 
    sendfile on; 
    tcp_nopush on; 
    tcp_nodelay on; 
    gzip on; 
    gzip_min_length 1000; 
    gzip_proxied any; 
    gzip_types text/plain text/css text/xml 
       application/x-javascript application/xml 
       application/atom+xml text/javascript; 

    # Only retry if there was a communication error, not a timeout 
    # on the Tornado server (to avoid propagating "queries of death" 
    # to all frontends) 
    proxy_next_upstream error; 

    server { 
     listen 80; 

     # Allow file uploads 
     client_max_body_size 50M; 

     location static/ { 
      root /srv/www/url/tornado/; 
      if ($query_string) { 
       expires max; 
      } 
     } 
     location = /favicon.ico { 
      rewrite (.*) /static/favicon.ico; 
     } 
     location = /robots.txt { 
      rewrite (.*) /static/robots.txt; 
     } 

     location/{ 
      proxy_pass_header Server; 
      proxy_set_header Host $http_host; 
      proxy_redirect off; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header X-Scheme $scheme; 
      proxy_pass http://frontends; 
     } 
    } 
} 

幫助深表感謝。

這是supervisord.conf:

[include] 
files = *.supervisor 

[supervisord] 

[supervisorctl] 
serverurl = unix://supervisord.sock 

[unix_http_server] 
file = supervisord.sock 

[rpcinterface:supervisor] 
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface 

[program:main] 
process_name = main-%(process_num)s 
command = python /srv/www/url/tornado/main.py 
--port=%(process_num)s 
--log_file_prefix=%(here)s/logs/%(program_name)s-%(process_num)s.log 
numprocs = 4 
numprocs_start = 8000 
+1

用'聽80 default_server嘗試;',或將一個'server_name'指令。 – 2014-09-26 16:13:48

回答

0

大膽猜測:增加一個服務器名稱參數去nginx的配置。

另外,當您啓動您的應用時,主管會說什麼? 如果沒關係(started),看看龍捲風和nginx日誌。

如果您在此處提供他們,找出答案就容易多了:)