linux - Nginx setup for local webapp and websocket -



linux - Nginx setup for local webapp and websocket -

following nginx configuration,

server { //part-1 hear 80; server_name _; location / { proxy_pass http://127.0.0.1:8090; proxy_redirect off; proxy_pass_request_headers on; proxy_set_header host $http_host; proxy_set_header x-real-ip $remote_addr; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection upgrade; } } server { //part-2 hear 80; server_name service; root /usr/local/tomcat7/webapps/service-snapshot; location / { proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080/serviceui/; } }

first part of config works fine websockets, using. sec part of config webapp running on apache tomcat 7.0.56, not working.

is there wrong config? assuming server_name in both parts might causing issue! suggestions!

while having multiple services on 1 ip , port working fine, server_name directive using host header submitted client/browser. in case, you're not supplying header instead asking specific location on same server (you're not asking http://_ or http://service http://yourserver/services see in comments).

to create work, have specify different services via locations this:

server { hear 80; server_name this_is_where_your_domain_or_maybe_localhost_goes; location / { proxy_pass http://127.0.0.1:8090; proxy_redirect off; proxy_pass_request_headers on; proxy_set_header host $http_host; proxy_set_header x-real-ip $remote_addr; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection upgrade; } location /service { root /usr/local/tomcat7/webapps/service-snapshot; proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8080/serviceui/; } }

linux tomcat nginx

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -