https://api.example.com/orders와 같은 API 호출이 수신되면 요청이 test1 환경의 메시지 프로세서로 전송됩니다. 마찬가지로 https://api.example.com/customers에 대한 요청이 수신되면 test2 환경으로 라우팅됩니다.
새 환경 추가
새 환경을 추가하려면 구성을 envs[] 속성에 추가하고 새 환경에 매핑할 기본 경로를 지정하는 새 virtualhosts.routingRules.path 항목을 추가합니다. 다음 예시에서는 test3라는 새로운 환경이 추가되고 두 경로를 새 환경으로 라우팅하도록 routingRules가 업데이트되었습니다.
virtualhosts[] 속성은 배열이므로 둘 이상의 속성을 만들 수 있습니다. 각 가상 호스트에는 고유한 호스트 별칭 집합이 포함되어야 합니다. 두 호스트로 동일한 호스트 별칭을 공유할 수 없습니다. 예를 들어 새로운 가상 호스트 dev는 api.internal.com 도메인으로 전송된 트래픽을 처리합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThis document details how to configure virtual hosts in Apigee hybrid to manage API requests across multiple domain names and route proxy basepaths to different environments.\u003c/p\u003e\n"],["\u003cp\u003eVirtual host names must be unique, contain no more than 253 characters, consist only of lowercase alphanumeric characters or hyphens, and start and end with an alphanumeric character.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003evirtualhosts.routingRules[]\u003c/code\u003e configuration property determines which environment specific API proxy base paths are routed to, and you can add new environments by modifying the \u003ccode\u003eenvs[]\u003c/code\u003e property and updating the \u003ccode\u003eroutingRules\u003c/code\u003e accordingly.\u003c/p\u003e\n"],["\u003cp\u003eMultiple virtual hosts can be created, each with its own unique set of host aliases, and any changes to the virtual host configurations are applied using the \u003ccode\u003eapigeectl apply\u003c/code\u003e command targeting the runtime component.\u003c/p\u003e\n"],["\u003cp\u003eWhen setting up a new virtual host, you must provide TLS key and certificate, and the document provides links to obtaining authorized credentials, as well as self-signed options for testing purposes.\u003c/p\u003e\n"]]],[],null,["# Configure virtual hosts\n\n| You are currently viewing version 1.2 of the Apigee hybrid documentation. **This version is end of life.** You should upgrade to a newer version. For more information, see [Supported versions](/apigee/docs/hybrid/supported-platforms#supported-versions).\n| **NOTE:** The `virtualhosts` configuration is new in version 1.2.0. The virtual host `name` must:\n|\n| - contain no more than 253 characters\n| - contain only lowercase alphanumeric characters or a hyphen `-`\n| - start with an alphanumeric character\n| - end with an alphanumeric character\n\n\nThis topic discusses virtual host configuration. Virtual hosts allow Apigee hybrid to handle\nAPI requests to multiple domain names and route proxy basepaths to specific environments.\n\n\nTo specify which environment specific API proxy base paths should be routed to, use the\n`virtualhosts.routingRules[]` configuration property. For details on the\nindividual properties, see [virtualhosts](/apigee/docs/hybrid/v1.2/config-prop-ref#virtualhosts)\nin the Configuration property reference. For example: \n\n```\n...\n\nvirtualhosts:\n - name: vhost-one\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n routingRules:\n - paths:\n - /orders\n - /items\n env: test1\n - paths:\n - /customers\n env: test2\n\nenvs:\n - name: test1\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n - name: test2\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n```\n\n\nWhen an API call comes in such as: `https://api.example.com/orders`, the request\nis sent to the `test1` environment's message processor. Similarly, if a request to\n`https://api.example.com/customers` comes in, it is routed to the `test2`\nenvironment.\n\nAdding a new environment\n------------------------\n\n\nTo add a new environment, add its configuration to the `envs[]` property, and\nadd a new `virtualhosts.routingRules.path` entry that specifies which base paths you\nwant to map to the new environment. In the following example, a new environment named\n`test3` is added, and the `routingRules` have been updated to\nroute two paths to the new environment: \n\n```\nvirtualhosts:\n - name: vhost-one\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n routingRules:\n - paths:\n - /orders\n - /items\n env: test1\n - paths:\n - /v0/hello\n - /httpbin\n env: test2\n - paths:\n - /v0/inventory\n - /v0/customers\n env: test3\n\nenvs:\n - name: test1\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n - name: test2\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n - name: test3\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n```\n\n\nTo apply the update, you only need to apply the `runtime` component, as follows: \n\n```\napigeectl apply -f overrides-file.yaml -c runtime\n```\n\nAdding multiple virtual hosts\n-----------------------------\n\n\nThe `virtualhosts[]` property is an array, and therefore you can create more than\none. Each virtual host must contain a unique set of host aliases: no two virtual hosts\ncan share the same host alias. For example, the new virtual host `dev` handles\ntraffic sent to the `api.internal.com` domain. \n\n```\nvirtualhosts:\n - name: vhost-one\n hostAliases: [\"api.example.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n routingRules:\n - paths:\n - /orders\n - /items\n env: test1\n - paths:\n - /v0/hello\n - /httpbin\n env: test2\n - paths:\n - /v0/inventory\n - /v0/customers\n env: test3\n\n - name: vhost-two\n hostAliases: [\"api.internal.com\"]\n sslCertPath: ./certs/fullchain.pem\n sslKeyPath: ./certs/privkey.pem\n routingRules:\n - paths:\n - /orders\n - /items\n env: test1\n - paths:\n - /v0/hello\n - /httpbin\n env: test2\n - paths:\n - /v0/inventory\n - /v0/customers\n env: test3\n\nenvs:\n - name: test1\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n - name: test2\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n - name: test3\n serviceAccountPaths:\n synchronizer: ./sa/synchronizer.json\n udca: ./sa/udca.json\n```\n\n\nTo apply the update, you only need to apply the `runtime` component, as follows: \n\n```\napigeectl apply -f overrides-file.yaml -c runtime\n```\n| **NOTE:** If you only add or change the `virtualhosts` stanza, and nothing else, then you can apply those changes with the `--settings` flag: \n|\n| ```\n| apigeectl apply -f overrides-file.yaml --settings virtualhosts -c runtime\n| ```\n|\n| If you change virtualhosts and envs, then you must apply the change without using `--settings`,\n| like this, to update the runtime component fully: \n|\n| ```\n| apigeectl apply -f overrides-file.yaml -c runtime\n| ```\n\nTLS keys and certificates\n-------------------------\n\nWhen you create a new virtual host, you must provide a TLS key and certificate.\nThe key/cert are used to provide secure communication with the ingress gateway.\n\n\nIt is up to you how you generate proper TLS certificate/key pairs for your hybrid\nconfiguration. The following topics are provided as samples only, intended primarily\nfor trying out or testing a new hybrid installation if it isn't feasible to obtain\nTLS credentials in another way:\n\n- See [Obtain TLS credentials](/apigee/docs/hybrid/v1.2/lets-encrypt) for a set of sample steps for creating an authorized TLS certificate/key pair.\n- You can use a self-signed certificate/key pair(s) for testing purposes only. See [Generate self-signed TLS credentials](/apigee/docs/hybrid/v1.2/environment-self-signed-tls)."]]