NGINX: ssl proxy based on path to multiple apps on localhost with different ports -


i'm trying configure nginx proxy requests different servers running on host machine different ports depending on request path. complicate things bit more, want apps use ssl. in other words want nginx following:

https://www.example.com/app1 --> http://localhost:8001 https://www.example.com/app2 --> http://localhost:8002 https://www.example.com/app3 --> http://localhost:8003 ... 

what got far (which not quite working):

# redirecting http https server {     listen 80;     301 https://$host$request_uri; }  # proxying path port server {     listen 443;     ssl_certificate     /path/to/cert.pem     ssl_certificate_key /path/to/privkey.pem     ssl_protocols       tlsv1 tlsv1.1 tlsv1.2;     ssl_ciphers         high:!anull:!md5;      location /app1 {         proxy_pass http://localhost:8001     }     location /app2 {         proxy_pass http://localhost:8002     }     location /app3 {         proxy_pass http://localhost:8003     } } 

what ends happening nginx exposes 1 specific app (that there first).

any ideas on i'm doing wrong appreciated. thanks.

replace nginc.conf following

    server {       listen 80 default_server;       listen [::]:80 default_server;       server_name _;       return 301 https://$host$request_uri;     }      server {       listen 443;       root /usr/share/nginx/html;        ssl on;       ssl_certificate    /etc/nginx/ssl/demo.com.crt;       ssl_certificate_key    /etc/nginx/ssl/demo.com.key;        ssl_protocols tlsv1 tlsv1.1 tlsv1.2;         ssl_prefer_server_ciphers on;         ssl_ciphers "eecdh+ecdsa+aesgcm eecdh+arsa+aesgcm eecdh+ecdsa+sha384 eecdh+ecdsa+sha256 eecdh+arsa+sha384 eecdh+arsa+sha256 eecdh+arsa+rc4 eecdh edh+arsa rc4 !anull !enull !low !3des !md5 !exp !psk !srp !dss";              chunked_transfer_encoding on;        location /app1 {          proxy_pass http://<private-ip>:8001       }       location /app2 {          proxy_pass http://<private-ip>:8002       }       location /app3 {          proxy_pass http://<private-ip>:8003       }      }   

copy .crt, .kry file in required folder


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -