2016-03-23 28 views
0

birden fazla uygulama:Raylar Nginx: I uygulamalar için iki nginx yapılandırmaları sahip

1) uygulama sorunu her iki adres olan

server { 
    listen 81; 
    server_name client.example.com; 
    root /home/deploy/clientapp; 

    location/{ 
    proxy_set_header X-Forwarded-Proto $scheme; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header Host $host; 
    proxy_redirect off; 
    proxy_http_version 1.1; 
    proxy_set_header Connection ''; 
    # proxy_pass http://app; 
    } 

    location ~ ^/(assets|fonts|system)/|favicon.ico|robots.txt { 
    gzip_static on; 
    expires max; 
    add_header Cache-Control public; 
    } 
} 

upstream app { 
    server unix:/home/deploy/railsapp/shared/tmp/sockets/puma.sock fail_timeout=0; 
} 

server { 
    listen 80; 
    server_name api.example.com; 

    root /home/deploy/railsapp/current/public; 

    try_files $uri/index.html $uri @app; 

    location/{ 
    proxy_set_header X-Forwarded-Proto $scheme; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header Host $host; 
    proxy_redirect off; 
    proxy_http_version 1.1; 
    proxy_set_header Connection ''; 
    proxy_pass http://app; 
    } 

    location ~ ^/(assets|fonts|system)/|favicon.ico|robots.txt { 
    gzip_static on; 
    expires max; 
    add_header Cache-Control public; 
    } 

    error_page 500 502 503 504 /500.html; 
    client_max_body_size 4G; 
    keepalive_timeout 10; 
} 

2) Statik html/js uygulama raylar api.example.com ve api.example.com aynı uygulamayı açın (api.example.com için)

+0

@PeterS Orijinal adresler olmayan bir örnektir. Her iki adres de aynı portu (80) dinlemeye çalıştım –

cevap