Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Puedes controlar una instancia de máquina virtual (VM) en Compute Engine como cualquier servidor estándar de Windows. En este instructivo, se muestra cómo implementar un servidor web IIS simple para que puedas aprender los conceptos básicos de la ejecución de un servidor web en una VM.
Antes de comenzar
Necesitarás una instancia de Windows nueva que admita el tráfico HTTP.
Sigue las instrucciones de la guía de inicio rápido para crear una instancia de Windows nueva y conectarla con RDP.
Instala IIS
En el campo de búsqueda de la barra de tareas de Windows, escribe PowerShell y presiona Enter. Si no hay un campo de búsqueda en la barra de tareas, haz clic en el ícono de búsqueda, escribe PowerShell y presiona Enter. Si la barra de tareas no tiene el campo ni el ícono de búsqueda, consulta Ubicación del cuadro de búsqueda en Windows 10.
En los resultados de la búsqueda, en Aplicaciones, haz clic con el botón derecho en Windows PowerShell y elige Ejecutar como administrador.
Instala los servicios IIS con los siguientes comandos:
Para ver la página Hello World!, copia la dirección IP de la columna IP externa y pégala en una pestaña nueva del navegador. Si no ves la página Hello
World!, sigue los pasos para solucionar problemas.
Limpia
Cuando termines de experimentar, sigue las instrucciones de limpieza en la guía de inicio rápido para evitar que se te cobre por esta instancia.
Soluciona problemas
Cuando recibes un error Connection Refused
Si te aparece un error Connection Refused, es posible que se den estas situaciones:
Tu instancia de VM no es accesible a nivel público porque la configuración de tus etiquetas o reglas de firewall tiene alguno de los errores siguientes:
La instancia de VM no tiene la etiqueta correspondiente que permite que Compute Engine aplique las reglas de firewall adecuadas a tu instancia.
Tu proyecto no tiene una regla de firewall que permita dirigir el tráfico a la dirección IP externa de tu instancia.
Intentas acceder a la VM mediante una dirección https. Verifica que la URL sea http://[EXTERNAL_IP] y no https://[EXTERNAL_IP].
Para asegurarte de que la instancia de VM tenga las etiquetas correctas, sigue estos pasos:
En la consola de Google Cloud, ve a la página Instancias de VM.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-04-22 (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]"]]