Skip to content

using subpath

redgoose edited this page Aug 3, 2020 · 1 revision

Using subpath

http://localhost:3000/foo/형식으로 주소를 접근할때가 있다. 이에대한 기록을 담아두고자 한다.

development

개발용 로컬호스트에서는 .env파일을 편집하여 개발용 주소를 http://localhost:3000/foo/형식으로 서버를 띄울 수 있습니다.

APP_URL="http://localhost:4000/foo"
APP_ROUTER_PATH="/foo"
APP_STATIC_PATH="/foo"

production with nginx

nginx를 이용한 도메인 서비스를 이용하고 있다면 nginx.conf 설정으로 proxy를 이용하여 서비스를 띄웁니다.

다음은 https://goose.com/foo/ 형태의 패스로 서버를 띄우는 설정값입니다.

server {
  listen 443 ssl http2;
  server_name goose.com;
  location /foo/ {
    proxy_pass http://127.0.0.1:4000/foo/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
  }
}
Clone this wiki locally