Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Anda dapat mengontrol instance virtual machine (VM) di Compute Engine seperti server Windows standar. Tutorial ini menunjukkan cara men-deploy server web IIS sederhana sehingga Anda dapat mempelajari dasar-dasar menjalankan server web di VM.
Sebelum memulai
Anda memerlukan instance Windows baru dengan traffic HTTP yang diizinkan.
Ikuti petunjuk Panduan Memulai untuk
membuat instance Windows baru dan menghubungkannya dengan RDP.
Menginstal IIS
Pada taskbar Windows, di kolom penelusuran, ketik PowerShell, lalu
tekan Enter. Jika tidak ada kolom penelusuran di taskbar, klik ikon
penelusuran, ketik PowerShell, lalu tekan Enter. Jika kolom penelusuran
atau ikon penelusuran tidak muncul di taskbar, lihat Menyembunyikan dan memperlihatkan kotak
penelusuran di Windows.
Di hasil penelusuran, pada bagian Apps, klik kanan Windows PowerShell, lalu pilih Run as administrator.
Lihat halaman Hello World! dengan menyalin alamat IP dari kolom IP Eksternal dan menempelkannya ke tab browser baru. Jika Anda tidak melihat halaman Hello
World!, ikuti Langkah pemecahan masalah.
Pembersihan
Setelah selesai bereksperimen, ikuti petunjuk pembersihan di Panduan Memulai agar tidak dikenai biaya untuk instance ini.
Pemecahan masalah
Menerima error Connection Refused
Jika Anda melihat error Connection Refused, mungkin:
Instance VM Anda tidak dapat diakses secara publik karena tag atau aturan firewall Anda salah dikonfigurasi dengan salah satu cara berikut:
Instance VM tidak memiliki tag yang tepat sehingga Compute Engine dapat menerapkan aturan firewall yang sesuai ke instance Anda.
Project Anda tidak memiliki aturan firewall yang mengizinkan traffic ke alamat IP eksternal untuk instance Anda.
Anda mencoba mengakses VM menggunakan alamat https. Pastikan URL Anda adalah http://[EXTERNAL_IP], bukan https://[EXTERNAL_IP].
Untuk memastikan bahwa instance VM Anda memiliki tag yang benar:
Di konsol Google Cloud , buka halaman Instance VM.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-19 UTC."],[[["\u003cp\u003eThis tutorial guides you through deploying a basic IIS web server on a Compute Engine virtual machine (VM) instance, similar to a standard Windows server.\u003c/p\u003e\n"],["\u003cp\u003eYou'll need to set up a new Windows VM instance, and ensure HTTP traffic is allowed before installing IIS and related services using PowerShell commands.\u003c/p\u003e\n"],["\u003cp\u003eAfter installing IIS, the default web page is overwritten with a "Hello World!" page using a command line entry.\u003c/p\u003e\n"],["\u003cp\u003eThe newly set up server is then tested by accessing the VM's external IP address in a browser to verify that the "Hello World!" page is properly displayed.\u003c/p\u003e\n"],["\u003cp\u003eTroubleshooting tips are included to address "Connection Refused" errors, highlighting the importance of proper firewall configurations, and confirming that traffic is being sent over \u003ccode\u003ehttp\u003c/code\u003e rather than \u003ccode\u003ehttps\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Running a basic IIS web server\n\n*** ** * ** ***\n\nYou can control a virtual machine (VM) instance on Compute Engine like any\nstandard Windows server. This tutorial shows you how to deploy a simple IIS web\nserver so you can learn the basics of running a web server on a VM.\n\nBefore you begin\n----------------\n\nYou'll need a new Windows instance with HTTP traffic allowed.\n\n- Follow the [Quickstart](/compute/docs/create-windows-server-vm-instance) instructions to create a new Windows instance and connect to it with RDP. \n\nInstall IIS\n-----------\n\n1. On the Windows taskbar, in the search field, type `PowerShell` and then\n press `Enter`. If there is no search field on the taskbar, click the search\n icon, type `PowerShell`, and then press `Enter`. If neither the search field\n nor the search icon appear on the taskbar, see [Hide and unhide your search\n box in Windows](https://support.microsoft.com/en-us/help/4028221/windows-10-locating-the-search-box-in-windows-10).\n\n2. In the search results, under **Apps** , right-click **Windows PowerShell** ,\n and choose **Run as administrator**.\n\n3. Install IIS services with the following commands:\n\n ```\n import-module servermanager\n ``` \n\n ```\n add-windowsfeature web-server -includeallsubfeature\n ```\n4. Overwrite the IIS web server default web page with the following command:\n\n ```\n echo '\u003c!doctype html\u003e\u003chtml\u003e\u003cbody\u003e\u003ch1\u003eHello World!\u003c/h1\u003e\u003c/body\u003e\u003c/html\u003e' \u003e C:\\inetpub\\wwwroot\\index.html\n ```\n\nTest your server\n----------------\n\nTest that your instance is serving traffic on its external IP:\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. View the `Hello World!` page by copying the IP address from the **External\n IP** column and pasting it into a new browser tab. If you do not see the `Hello\n World!` page, follow the [Troubleshooting steps](/compute/docs/tutorials/basic-webserver-iis#troubleshooting).\n\nClean up\n--------\n\nWhen you're done experimenting, follow the clean up instructions in the\n[Quickstart](/compute/docs/create-windows-server-vm-instance#clean-up) to avoid incurring\ncharges for this instance.\n\nTroubleshooting\n---------------\n\n**Receiving a `Connection Refused` error**\n\nIf you are seeing a `Connection Refused` error, it is possible that:\n\n- Your VM instance is not publicly accessible because your firewall rules or\n tags are misconfigured in one of the following ways:\n\n - The VM instance does not have the proper tag that allows Compute Engine to apply the appropriate firewall rules to your instance.\n - Your project does not have a firewall rule that allows traffic to the external IP address for your instance.\n- You are trying to access the VM using an `https` address. Check that your\n URL is `http://[EXTERNAL_IP]` rather than `https://[EXTERNAL_IP]`.\n\nTo ensure that your VM instance has the correct tags:\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. Click the name of the instance that you are trying to connect to.\n3. Click **Edit** at the top of the page.\n4. Scroll down to **Firewalls** , and make sure the **Allow HTTP traffic** box is checked. If it is not checked, check it.\n5. Save your changes. This ensures that the correct tags are added to the VM instance.\n\nTo ensure that the correct firewall rule exists:\n\n1. In the Google Cloud console, go to the **Firewall rules** page.\n\n [Go to Firewall rules](https://console.cloud.google.com/networking/firewalls)\n2. Look for a firewall rule that allows all IP ranges through tcp:80. Usually, this rule is named the `default-allow-http` rule.\n3. If a rule does not exist, create one.\n 1. Click **Create firewall rule**.\n 2. Enter a name for the rule, such as `default-allow-http`.\n 3. Under **Source IP ranges** , enter `0.0.0.0/0` to allow traffic from all sources.\n 4. Under **Protocols and ports** , check **Specified protocols and ports** and enter `tcp:80`.\n 5. Create your firewall rule.\n\nTest your server again by going to the external IP address of the instance: \n\n http://[EXTERNAL_IP]"]]