I installed a MEAN stack on Google Cloud Engine (GCE) via this link.
So the engine created my instance successfully and it looks like this:
I created a new firewall rule to accept any incoming requests (actually do I need to do this? default-allow-http has the same rule right?):
But when I try to access the IP using Chrome, I get an error. The error persists even when I change the browser e.g. IE or Firefox:
I have confirmed that I can ping the address:
I even tried to assign a domain name to the instance but it still does not work:
May I know what I am doing wrongly?
Would appreciate any advice! Thanks in advance!
Viewing IP addressesIn the Google Cloud console, go to the VM instances page. If the VM instance has an external IP address, it appears under the External IP column. If a VM does not have an external IP address, you can assign one.
In the Google Cloud console, go to the VM instances page. In the list of VMs, click the arrow_drop_down drop-down next to the SSH button of the VM that you want to connect to. Click Open in browser window using provided private SSH key. The SSH-in-browser window opens.
To connect to an instance without an external IP address, use the gcloud compute ssh command with the --internal-ip flag. In the Google Cloud console, go to the VM Instances page and find the internal IP address for the instance that you want to connect to. Connect to the instance.
Log in to the Google Cloud Console and select your project. Navigate to the “Compute Engine -> VM Instances” page and select the server you wish to connect to. Click the “Edit” link in the top control bar. On the resulting page, copy and paste your public SSH key into the “SSH Keys” field.
I had the same problem after installing the JIRA Core app, and I was able to solve it with the following steps. I honestly did not install MEAN stack but most of the steps to solve this error must be the same (except for port verification and service execution).
The first thing is to detect the port used by MEAN stack app in the official documentation and in some configuration file generated by the installation of the app. According to information in the comments the app uses the port 3000
You go to the GCP console to add a VPC Network firewall rule.
a. You choose the project where you have the instance.
b. Select VPC Network -> Firewall Rules -> Create
c. Name: mean-stack
d. Intervals of IPs: 0.0.0.0/0
e. Protocols/ports: tcp:3000; udp:3000
List the ports that the VM is listening to or the firewall enables from the Cloud Shell:
$ netstat -an | grep "LISTEN "
You have to open the port for MEAN stack that blocks the firewall. If the port is listening, this step is not necessary:
$ sudo apt-get install ufw
$ sudo ufw enable
$ sudo ufw allow ssh
//so as not to be disconnected from the instance by ssh
$ sudo ufw allow 3000
If the app uses more control ports, you must also enable them
You should check that the app is on and running with some command (For example: sudo /opt/bitnami/ctlscript.sh start apache)
You should test if you can access the MEAN stack app locally through the URL. The following command does NOT have to give me connection refused.
$ sudo wget http://localhost:3000
Do not enter the URL generated by wget, as it must be done with an external ip.
Finally, after creating a firewall rule for the project of the instance and enabling the port that blocks the firewall you can access from any client through the browser.
http://< external-ip-vm >:< port >
http://104.154.39.199:3000
I hope I can help you at some point. GL
MEAN stack app is running with Express on port 3000 (default address) only on localhost address for security reason. To promote application to be visible on internet (on port 80), just create a proxy reverse clause on apache (or nginx, or...).
sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
add this statement like this : ProxyPass http://localhost:3000 ProxyPassReverse http://localhost:3000
sudo /opt/bitnami/ctlscript.sh restart apache
if app is lauched on your instance you can open it using http://address_of_VMInstance/yourapp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With