How to use nginx as reverse proxy to direct localhost:9292 to a sub domain foo.localhost/? -


i've learned how pass localhost:9292 localhost/foo following directive:

location /foo {     proxy_pass http://localhost:9292; } 

but want like

foo.localhost -> localhost:9292 

is there way can that?

if foo.localhost sub domain name , want proxy pass sub-domain main-domain, can use proxy_pass , can learn little more server directive if needed. example:

server {   listem 8080;   host sub.main.com;   ...   location / {     proxy_pass http://main.com;     break;   } } server {   listen 8081;   host main.com;   ...   location / {     //do   } } 

this proxy pass, means when access sub.main.com, dealt main.com, client side still shows sub.main.com. if want client side shows main.com, here should use redirect not proxy_pass.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -