nginx Æ÷Æ® Æ÷¿öµù

¸®¿À   
   Á¶È¸ 11120   Ãßõ 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 2211/5605
2015-12   1091167   ¹é¸Þ°¡
2014-05   4540896   Á¤ÀºÁØ1
2021-03   2613   Psychophysi¡¦
2015-06   4319   ½É¿ìö
2016-07   3889   ¸·µÇ¾î¸ÔÀº¡¦
2011-12   6089   ±èÁØÀ¯
2014-02   6701   ´ëÇѹα¹
2015-06   3266   ¸ð¾Æ·¹±èÈ£¿­
2017-07   4542   Àü¼³¼ÓÀǹ̡¦
2011-12   6426   ¼Òõ¹éÇâ
2012-01   5976   ¾Æ¸§´Ù¿î³ëÀ»
2018-11   3779   ¾È°³¼Ó¿µ¿ø
2012-01   5479   Olorin
2022-12   2935   ¹«¹ýÀÚ
2012-01   7246   À̺´ÇÑ
2012-01   5857   ±è½Â±Ç
2015-07   4700   ÀÓ¿µÃ¶
2021-04   2391   ÇÁ·Î½Ã¾Æ
2014-03   11664   ¿©ÁÖÀÌ»óµ·
2012-02   5119   ¹Ì¼ö¸Ç
2018-11   3566   µ¿ÇàÅ¥ºê
2022-12   900   ¶Ñ¾Ó