How to access the IP address of an instance of Google Cloud Engine through a browser

I installed the MEAN stack on Google Cloud Engine (GCE) using this.

So, the engine successfully created my instance and looks like this: GCE Instance Information

I created a new firewall rule to accept any incoming requests (actually I need to do this: default-allow-http has the same rule?): enter image description here

But when I try to access the IP address using Chrome, I get an error. The error persists even when I change the browser, for example. IE or Firefox:

enter image description here

I confirmed that I can send the address: enter image description here

I even tried to assign a domain name to the instance, but it still does not work: enter image description here

Can I find out what I am doing wrong?

Would thank for any advice! Thanks in advance!

+8
source share
4 answers

I had the same problem after installing the JIRA Core application, and I was able to solve it using the following steps. Honestly, I did not install the MEAN stack, but most of the steps to resolve this error should be the same (with the exception of checking the port and executing the service).

  1. First of all, you need to determine the port used by the MEAN stack application in the official documentation and in some configuration file generated during application installation. According to the information in the comments, the application uses port 3000

  2. You go to the GCP console to add the VPC network firewall rule.

    a. You select a project in which you have an instance.

    b. Choose VPC Network β†’ Firewall Rules β†’ Create

    .with. Name: middle stack

    e. IP Intervals: 0.0.0.0/0

    e. Protocols / ports: tcp: 3000; UDP: 3000

  3. List the ports that the virtual machine is listening on or the firewall includes in the cloud:

    $ netstat -an | grep "LISTEN "

  4. You must open the port for the MEAN stack, which blocks the firewall. If the port is listening, this step is not required:

    $ sudo apt-get install ufw

    $ sudo ufw enable

    $ sudo ufw allow ssh // not to disconnect from the instance using ssh

    $ sudo ufw allow 3000

    If the application uses more control ports, you should also enable them.

  5. You should check that the application is turned on and works with some kind of command (for example: sudo / opt / bitnami / ctlscript.sh, run apache)

  6. You should check if you can access the MEAN stack application locally through the URL. The following command MUST NOT give me a connection denial.

    $ sudo wget http://localhost:3000

    Do not enter the URL generated by wget, as this should be done with an external ip.

  7. Finally, after creating a firewall rule for the instance project and enabling the port blocking the firewall, you can access it from any client through a browser.

    HTTP: // & l; external-ip-vm>: & lt; port>

    http://104.154.39.199haps000

I hope I can help you at some point. GL

+3
source

The MEAN stack application works with Express on port 3000 (the default address) only at localhost for security reasons. To make the application visible on the Internet (on port 80), simply create a proxy reverse sentence on apache (or nginx or ...).

sudo nano / opt / bitnami / apache2 / conf / bitnami / bitnami-apps-vhosts.conf

add this statement as follows: ProxyPass http: // localhost: 3000 ProxyPassReverse http: // localhost: 3000

sudo / opt / bitnami / ctlscript.sh restart apache

if the application is displayed on your instance, you can open it using http: // address_of_VMInstance / yourapp

+1
source

In more detail - The task of the firewall is simply to intercept the forbidden incoming connections and quietly drop them.

In this case, you: (a) see the ping responses from the VM's public IP address, which indicates that ICMP is not blocked by the firewall. (b) see the TCP RST packet sent by the virtual machine in response to the TCP SYN packet sent by your browser when it tried to connect to the TCP server on the virtual machine. This indicates that packets addressed to TCP port 80 are also forwarded by the firewall, as expected.

There is no server application on your virtual machine that listens for connections on port 80, receives HTTP requests, and responds. You can try running, say, Apache (or Nginx, which is even easier to configure).

In response to your other question, you do not need the second tcp: 80 firewall rule, but if you want the HTTP rule to allow packets to your virtual machine by default, you will need a tag for your virtual machine labeled "http -server".

0
source

Error CONNECTION_RESET. I think the MEAN stack is not listening on port 80.

-1
source

Source: https://habr.com/ru/post/1247572/


All Articles