nginx Æ÷Æ® Æ÷¿öµù

¸®¿À   
   Á¶È¸ 11453   Ãßõ 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 2289/5729
2014-05   5260908   Á¤ÀºÁØ1
2015-12   1785670   ¹é¸Þ°¡
2013-04   5905   ¼­Çö¼®
2006-02   5905   ±è¿µ¼ö
2006-04   5905   À±Á¾¿Ï
2005-08   5905   À嵿¹Î
2005-10   5905   À±È£¿ë
2013-01   5905   ÇÏ·çÄ«
2016-02   5905   inquisitive
2008-01   5905   ±èÁ¤°­
2008-09   5905   ±èº¹¸¸
2006-06   5905   ±è°Ç¿ì
2014-03   5905   ¹è°íÇÁ°í°¡¡¦
2005-06   5905   ÇÑ»óõ
2006-05   5905   ¼­ÅÂÈñ
2005-06   5905   ¼ÒÇöÁØ
2007-12   5904   ¼Õ»ó¿í
2008-02   5904   ÀÓÁø¿í
2016-01   5904   À̽¹Î386
2016-08   5904   ¹ÚÇö±Ù
2008-03   5904   Çѵ¿ÈÆ
2016-11   5904   ¿ø½ÃÀÎ7