: Connect timeout from external clients? I had a MEAN site hosted on DigitalOcean, and now I moved it to an EC2 micro instance. I imported the database, set up PM2, copied all files and everything,
I had a MEAN site hosted on DigitalOcean, and now I moved it to an EC2 micro instance. I imported the database, set up PM2, copied all files and everything, and set up Nginx as a reverse proxy. No biggie.
When I "curl localhost", the site loads perfectly. But I can't connect to it from anywhere except localhost. For example, running "curl " on the old VPS gives a "connection timed out" error. And when I try to access the site in Chrome, it loads until a timeout error as well.
As you can imagine, I am confused. The following is my /etc/nginx/sites-available/default:
server {
listen 80;
server_name my-domain.com my-domain.com;
return 301 $server_name$request_uri; }
server {
listen 443 default_server;
ssl on;
server_name my-domain.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
location / {
proxy_pass localhost:3000; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Is there something I am missing here? Thanks again, just very new to AWS, and a bit confused.
More posts by @Miguel251
1 Comments
Sorted by latest first Latest Oldest Best
Found the answer.
On an EC2 instance, ensure the following:
Nginx is on, and whatever server_name you're using will allow you to access it.
If your server has UFW on, then make sure incoming TCP connections are allowed (on ports 80 and 443)
Lastly, go to "edit inbound rules" in your instance's security group, and allow incoming connections via 80 and 443.
Good to go!
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.