Gatsby on EC2 doesn't connect externally - amazon-ec2

I have a development installation of Gatsby Doc site running on my EC2 server.
When I run the code on my dev machine it works and I can connect my browser to port 8000 and everything is ok..
On my server i check out my github code and
yarn install
npm run start.
Everything builds correctly and Gatsby it listening on port 8000
From my dev machine when I connect using
X.X.X.X:8000 in my browser i receive
Unable to connect
I have opened the port on 8000 in the firewall and I have tested that it works as expected using:
nc -lv 8000
on the server (where gatsby is going to run) and connect using telnet.
on the server i receive
Listening on [0.0.0.0] (family 0, port 8000)
Connection from 84.232.Y.Y 38552 received!
So it works.
When Gatsby is finished starting i see
You can now view gatsbyjs.org in the browser. ⠀ http://localhost:8000/
⠀
when i enter the web address and port i receive
Unable to connect
again. do I need to start Gatsby in another mode?
Kim

I found out.
I just added -H 0.0.0.0 to the start up command and everything works now.

Related

How to deploy Laravel project using Remote Desktop Connection and AWS and run the application on {MY_IP}:8000/

I had made an EC2 instance on my AWS and also established the connection with RDC in my local system.
Installed my required modules and set up the environment for the Laravel successfully.
Xampp is also installed and the database connection is established
And my project is running perfectly in that RDC system's Localhost on port 8000
My problem I am not able to run my solution on port 8000 when I am hitting the server with my IP.
Basically, no port other than port 80 is opening via IP
How can I open my project on port 8000 via my IPv4 or IP?
I have got the solution to this.
Instead of deploying the project on localhost:{my_ip} to deploy it at 0.0.0.0:{my_ip}
In Laravel run this command in the workspace ok the project, it will be reflected on the respective domain as well.
php artisan serve --host 0.0.0.0 --port 8000
--host defines the hostname of the project and port defines the port on which you are planning to deploy your source.
it solved my problem hope it will help !!!

Error > Could not connect to Cloud Shell on port 8080 > While connecting the Visual Code using code-server

Trying to install Visual Code IDE in VM Instance. After running the code-server, while checking view on browser, it is giving an error.
Error: Could not connect to Cloud Shell on port 8080.
Ensure your server is listening on port 8080 and try again.
enter image description here
reference link to install VS Code in GCC:
https://medium.com/google-cloud/how-to-run-visual-studio-code-in-google-cloud-shell-354d125d5748
Try openning on your browser:
http://[your-external-ip]:8080/
Its important to change the default "https" to "http".
I also added the port 8080 on my firewall permisions on gcp.
You should set your host to 0.0.0.0. When you start the server, your command could be like this:
./code-server --no-auth --port 8080 --host 0.0.0.0
And everything should work fine. Try it :D

Unable to get Xdebug working with EC2 server

I'm attempting to get Xdebug connecting to my PhpStorm from an EC2 instance.
I have opened up port 9000 on the security group tied to the EC2 instance.
Prior to opening it up with UDP, I would get:
telnet: connect to address <IP>: Connection refused
telnet: Unable to connect to remote host```
After opening it up, I get:
Trying <IP>... and it just hangs there.
I port forwarded 9020 internally to 9000 externally to see if that would give any different results (since I can't find a setting on the router for simply opening up ports)
My xdebug.ini setting is located at: /etc/php-5.6.d/50-xdebug.ini (yes, very old version of PHP that I have to work with here).
My xdebug.ini contains this:
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back = On
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode = req
I'm using PhpStorm, and have it listening on port 9020 now (tried 9000 prior to port forwarding with the same result).
I have the Xdebug browser extension installed and have it set to PHPSTORM.
I have stop on first line turned on, as well as breakpoints just in case.
Xdebug is set to listen.
When I hit the PHP page from my browser, nothing happens. I've had this working dozens of times, but never from an EC2 instance. Any idea what I missed?

Mac docker unable to access port 80 with nginx

I'm following the tutorial "Getting started with Docker for Mac" but I'm unable to access the nginx home page at localhost. Every time I access localhost, the displayed page is "It works!" which is the default page contained in /Library/WebServer/Documents/index.html.en. I tried to kill all httpd services to remove the binding to the port 80 but it didn't change anything. I also checked that there wasn't any application that was running on port 80 and that neither Skype, MAMP or an Apache server who could be using this port was running.
I think that my Docker installation is correct as I'm able to run the docker --version, docker-machine --version and docker-compose --version without error. I'm running the container with the command described in the tutorial
docker run -d -p 80:80 --name webserver nginx but it doesn't work. I tried many ports but it didn't change anything.
Here is the output of a
docker ps
So I tried to access the app via 0.0.0.0:80 but it didn't work neither, it always redirect me to the page contained in Library/WebServer/Documents/index.html.en. I tried binding to all kind of ports (8080:80, 8181:81, 8181:80, 8181:8181 ...) and nothing never changed. In those case, I got a page telling me
"Safari can't connect to server. Safari can't open the page "0.0.0.0:8080" because Safari can't connect to server "0.0.0.0".
I also tried replacing localhost by 127.0.0.1 but I still have the issue.
If you need further explanations or have any question, ask me. Thanks in advance for your help

Cannot access localhost:8080 from laravel

I have a PHP application running on homestead box. This application makes calls to another app that is running on glassfish on my localhost:8080.
When PHP application sends the request to localhost:8080, I am getting following error:
ConnectException in RequestException.php line 49:
cURL error 7: Failed to connect to localhost port 8080: Connection refused
Still I can make calls to localhost:8080 from web browser.Anyone has any suggestion?
Seeing how your application is running in Homestead (which by default is available on 192.168.10.10 and is forwarded to also be accessible on localhost:8000) your application running on Glassfish will not have access to it using localhost:8080. This is because localhost in your vagrant box (Homestead) is not actually the same localhost as on the host machine.
What you could do is grab the ip address from the host machine and connect to it from your application running in Homestead.
So here is how I could solve the problem. Vagrant is the guest machine running on my localhost as host machine. To access host from guest, you need to use gateway from VB.
I found this answer which helped me to access my application on localhost.

Resources