이 페이지에서는 Cloud Shell에서 웹 미리보기 기능을 사용하는 방법을 설명합니다.
이 기능을 사용하면 Cloud Shell 가상 머신 인스턴스에서 웹 애플리케이션을 실행하고 Google Cloud Console에서 미리 볼 수 있습니다.
웹 미리보기 버튼 은 Cloud Shell 작업 표시줄의 오른쪽 상단에 있습니다.
웹 애플리케이션 시작
Cloud Shell 가상 머신에서 App Engine 개발 서버를 포함하여 HTTP 요청을 리슨하는 모든 웹 애플리케이션을 실행할 수 있습니다. 웹 애플리케이션은 2000~65000의 허용 범위 내 포트에서 HTTP 요청을 리슨해야 합니다. 이러한 포트는 HTTPS상의 액세스를 사용자 계정에 한해 제한하는 보안 Cloud Shell 프록시 서비스 대상으로만 사용 가능합니다.
간단한 서버 예시
Cloud Shell 명령 프롬프트에서 단순한 Python HTTP 서버를 시작하려면 다음을 수행하세요.
[[["이해하기 쉬움","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-03-24(UTC)"],[],[],null,["# Preview web apps\n\nThis page describes how to use the web preview feature in Cloud Shell.\nThis feature allows you to run web applications on the Cloud Shell virtual\nmachine instance and preview them from the [Google Cloud console](https://console.cloud.google.com/).\n\nThe Web Preview button\ncan be found on the top right of the Cloud Shell taskbar.\n\nStart the web application\n-------------------------\n\nYou can run any web application that listens to HTTP requests on the\nCloud Shell virtual machine, including the App Engine development server. The web\napplication must listen for HTTP requests on ports within the permitted range\n2000 to 65000. These ports are only available to the secure Cloud Shell proxy\nservice, which restricts access over HTTPS to your user account only.\n\n### Simple server example\n\nTo start a simple Python HTTP server from the Cloud Shell command\nprompt: \n\n```sh\ncd `mktemp -d` \\\n && echo '\u003chtml\u003e\u003cbody\u003eHello World\u003c/body\u003e\u003c/html\u003e' \u003e./index.html \\\n && python -m http.server 8080\n```\n\n### App Engine development server example\n\nTo clone a sample App Engine application and run it on the\nApp Engine development server: \n\n```sh\ngit clone https://github.com/GoogleCloudPlatform/appengine-guestbook-python \\\n && cd appengine-guestbook-python \\\n && dev_appserver.py ./app.yaml\n```\n\nThe development server runs on port 8080 by default.\n\nPreview the application\n-----------------------\n\nClick the **Web Preview** button\nand then select\nthe port number from the displayed menu. Cloud Shell opens the preview URL on\nits proxy service in a new browser window.\n\nYou can also access the preview URL by combining the port with the environment\nvariable `WEB_HOST` in the Cloud Shell terminal using the format `https://$PORT-$WEB_HOST`,\nor by using the [Cloud Shell API](/shell/docs/reference/rpc/google.cloud.shell.v1#environment).\n\nAccessing Streamlit applications\n--------------------------------\n\nWeb preview in Cloud Shell works through a series of HTTP proxies.\nStreamlit applications require [additional arguments](https://github.com/streamlit/streamlit/issues/6305) to function when running\nbehind an HTTP proxy. When running these applications, make sure you specify\n`--browser.serverAddress=localhost --server.enableCORS=false --server.enableXsrfProtection=false`\non the command line."]]