0
I zwei nginx Konfigurationen für Anwendungen haben:Rails Nginx: mehrere Anwendungen
1) Rails-Anwendung
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) Statische HTML/JS Anwendung
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;
}
}
Das Problem beiden Adressen sind api.example.com
und api.example.com
öffnen Sie die gleiche Anwendung (für api.example.com
)
@PeterS Es ist nur ein Beispiel ohne ursprüngliche Adressen. Beide Adressen sind Subdomains –