nginx Æ÷Æ® Æ÷¿öµù

¸®¿À   
   Á¶È¸ 11234   Ãßõ 0    

안녕하세요.

8888 포트로 돌리고 있는 앱이 하나 있다고 가정하고..

접속 주소를 www.test.com:8888 라고 할때..

( www.test.com:8888 주소로 가면..

바로 www.test.com:8888/login.html 로 이동하도록 되어있습니다.)


여기에 nginx를 설치해서..

www.test.com:8888 이 주소를.. 

www.test.com/test 가 되게 해줄수 있을까요?



혼자 검색을 해서 단순하게.. 아래처럼 설정을 하고..


   server {
        listen       80;
        server_name  *.test.com;

location /test/ {
        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:8888/;

  }


브라우저 주소창에  www.test.com/test 라고 치면..

주소가 아래와 같이 이동되면서.. 

www.test.com/login.html

nginx 의 404 Not Found 에러가 나버리는데..ㅠ.ㅠ


제가 원한 결과는.. 

www.test.com/test/login.html

이렇게 되는거거든요..ㅠ.ㅠ



이게 가능하려면 어떻게 해야 할까요?

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
Á¤Èñ¼· 2016-08
proxy_pass ¸¸ °¡Áö°í Å×½ºÆ® Çѹø Çغ¸½ÃÁö¿ä
°íÁî³Ë 2016-08
http://serverfault.com/questions/598003/nginx-as-a-proxy-for-tomcat-with-subdirectory Âü°íÇϼ¼¿ä
/ Áö¿ì°í rewrite¹® ÀÛ¼ºÇÏ¼Å¾ß ÇÒ µí ÇÕ´Ï´Ù.
location /test {
rewrite ^(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8888/test/;
}


ÀÌ·¸°Ô ÇϽøé

www.test.com:8888/test

·Î Á¢¼Ó ÇßÀ»¶§
127.0.0.1:8888/test ¿¡¼­ ÀÛµ¿ÇÕ´Ï´Ù.
2Â÷ µµ¸ÞÀÎÀ¸·Î °¢°¢ ´Ù¸£°Ô Á¢¼Ó µÇ°Ô ÇÏ°í ½Í´Ù¸é
http{
server {
listen 8888;
server_name test.test.com;
proxy_set_header  X-Real-IP  $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;

location / {
rewrite ^(.*)$ /$1 break;
proxy_pass  http://127.0.0.1:8888/test/;
}
}

server {
listen 8888;
server_name service.test.com;
proxy_set_header  X-Real-IP  $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;

location / {
rewrite ^(.*)$ /$1 break;
proxy_pass  http://127.0.0.1:8888/service/;
}
}
}


ÀÌ·±½ÄÀ¸·Î ¼³Á¤ Çϸé
test.test.com À¸·Î Á¢¼Ó Çϸé 127.0.0.1:8888/test ¿¡ Á¢¼ÓÇÑ°Í°ú °°ÀÌ ÀÛµ¿
service.test.com À¸·Î Á¢¼ÓÇϸé 127.0.0.1:8888/service ¿¡ Á¢¼ÓÇÑ°Í°ú °°ÀÌ ÀÛµ¿ÇÕ´Ï´Ù.


À§¿Í °°Àº ¹æ¹ýÀ¸·Î µµ¸ÞÀÎ Çϳª¸¦ °¡Áö°í ¿©·¯ ¼­¹ö¿¡ ºÐ»êÇؼ­ ¼­ºñ½º ÇÏ½Ç ¼ö ÀÖ¾î¿ä.


QnA
Á¦¸ñPage 786/5664
2015-12   1439668   ¹é¸Þ°¡
2014-05   4901073   Á¤ÀºÁØ1
2016-08   4053   ¹«¾Æ
2017-08   3706   NAS°íÀå³µ´Ù¡¦
2015-07   3327   Á¤¿¬
2005-09   6349   ¹ÎÁ¤±â
2012-03   5057   6Åø
2014-03   7498   ȸ¿øK
2015-08   3117   ittutti
2017-08   3794   ¼­ÇüÈ£
2008-11   4850   ¹ÚÁø±¹
2016-08   6740   ±è°Ç¿ì
2003-01   11222   õÈñ½Â
2016-08   11235   ¸®¿À
2020-01   3888   Àç´Ï¯
2014-04   6879   ȸ¿øK
2023-01   3180   ÇÇÅÍÄþ
2005-10   5293   ¿ÀÁØÈ£
2017-09   3180   Noman
2020-01   2996   »Ç·Î·Õ·Õ·Õ
2008-12   4936   À庴µÎ
2012-03   5946   ¹æoÈ¿o¹®