[507a54]: / production / nginx / default.conf

Download this file

97 lines (76 with data), 2.7 kB

# Change hash bucket size, because of large number of server names are defined 
server_names_hash_bucket_size  128; 

# Redirect http requests to the https
server {
    listen       80;
    server_name  example.com www.example.com;
    access_log  off;
    
    return 301 https://example.com$request_uri;
}

# Redirect https requests of the example.com domain to the 8501 port of ui server
server {
    listen 443 ssl;
    server_name example.com www.example.com;
    access_log  off;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    
    proxy_http_version 1.1; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;

    # streamlit specific: 
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
    
    # Reverse proxy to ui:8501
    location / {
        proxy_pass  http://ui:8501;
    }
}

# Redirect http requests to the https
server {
    listen	 80;
    server_name  api.example.com;
    access_log  off;
    
    return 301 https://api.example.com$request_uri;
}

# Redirect https requests of the api.example.com domain to the 5005 port of rasa server
server {
    listen 443 ssl;
    server_name api.example.com;
    access_log  off;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    # Reverse proxy to rasa:5005
    location / {
        proxy_pass  http://rasa:5005;
    }
}

# Redirect http requests to the https
server {
    listen       80;
    server_name  monitoring.example.com;
    access_log  off;

    return 301 https://monitoring.example.com$request_uri;
}

# Redirect https requests of the monitoring.example.com domain to the 8501 port of monitoring server
server {
    listen 443 ssl;
    server_name monitoring.example.com;
    access_log  off;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

    proxy_http_version 1.1; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;

    # streamlit specific: 
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
    
    # Reverse proxy to rasa:5005
    location / {
        proxy_pass  http://monitoring:8501;
    }
}