2017-05-20 4 views
0

새로 작성하는 경우 새로 작성하십시오. 내 호스트에서 2 개의 서비스 실행 :nginx를 프록시로 다시 쓰는 방법은 무엇입니까?

location /{ 
     #this works fine 
     proxy_pass http://myMainServiceIp/;  
    } 

    location /wordpress{ 
     #works but redirects to http://example.com/wp-admin/install.php 
     #rather than http://example.com/blog/wp-admin/install.php 
     proxy_pass http://wordpressServiceIp/;  
    } 

/blog/*params*/*etc*/*etc*을 내 워드 프레스 서비스로 올바르게 전달할 수 있습니까?

답변

0

두 가지 별도의 관련 문제가 있습니다. location은 후속 /이 필요하므로 proxy_pass은 URI의 별명을 올바르게 지정할 수 있습니다.

location /blog/ { 
    proxy_pass http://wordpressServiceIp/;  
} 
location = /blog { 
    rewrite^/blog/ last; 
} 

하나의 특별한 경우를 처리하기 위해 두 번째 위치 블록을 추가했습니다.

두 번째 문제는 HOME이며 SITEURL은 http://example.com/blog/을 가리켜 야합니다. 자세한 내용은 this document을 참조하십시오.

관련 문제