I am running a Linux instance on EC2. It is running Apache on port 80 and a custom nodejs server on port 8080.
I would like to use a subdomain to redirect the petitions from port 80 to 8080.
Traffic to nodejs.mydomain.com:80 should be redirected to the EC2 server on port 8080.
Is that possible using AWS VPC?
I do not want to configure Apache as a proxy.
More details about the current configuration:
The instance has attached an Elastic IP address.
I'm using Route 53 to point my domain to this IP
The instance is running inside a VPC
The server is on production so I'm looking for a minimum downtime
Thanks for your help.
Related
I am trying to setup multiple containers listening on different ports hosting sites.
Example:
example1.com 8080 -> 80 container1 (apache)
example2.com 8081 -> 80 container2 (apache)
What is the correct way to do it?
I have tried http redirects/rewrites (inside containers) but cannot get it to work..
You need a reverse proxy on the server. I'd go with nginx and configure it similar to here to forward traffic to example1.com to its own port 8080. In Apache this can be done as well. It's called virtual hosts
im having a server running ubuntu with docker.
I have a docker instance running Nginx Proxy Manager to serve my multiple domains.
I want to run a mail server but since Nginx is using port 443 for HTTPS and 80 for HTTP i cant install any docker image's since they make use of both 80 and 443.
Example https://poste.io/doc/getting-started#download its also make use of the same ports.
Any idea how to have a single IP and host both web and mail?
I have followed this tutorial for deploying docker containers on AWS EC2 instance:
https://www.digitalocean.com/community/tutorials/how-to-secure-a-containerized-node-js-application-with-nginx-let-s-encrypt-and-docker-compose
and after reaching step 5 (where nginx is configured for HTTPS), the application just stops working. Here's my application: www.alphadevop.co
Here’s my nginx configuration:
https://github.com/cyrilcabo/alphadevelopment/blob/master/nginx-conf/nginx.conf
And here’s my docker-compose.yml:
https://github.com/cyrilcabo/alphadevelopment/blob/master/docker-compose.yml
[Here's the webserver logs][1]
[1]: https://i.stack.imgur.com/oawtD.png
Silly mistake, port 443 wasn't allowed on my application. I was confused because when i checked on my server, port 443 was open. Then I checked here, https://www.yougetsignal.com/tools/open-ports/ , saying it was closed. I then found out that there's an inbound rule for AWS EC2 instance top allow port 443.
Credits here: NGINX SSL Timeout
I have a NodeJs/Express project in Alibaba cloud based Ubuntu server.
When I run project and access with curl localhost:3000 and curl 127.0.0.1:3000 it works!
When I access with IP public, e.g. curl 192.x.x.x:3000 it doesn't work, even though I have edited config in Express project in some code to : server.listen(3000,"0.0.0.0") OR server.listen("3000","192.x.x.x").
FYI I have Apache on this server. When I access on Internet with IP public no problem.
What can I do to solve this problem? Thanks beforehand.
PS: the 192.x.x.x is my IP public and it works access with Apache project
Issue the following command to open port 3000 for TCP traffic.
sudo ufw allow 3000/tcp
You have to configure your security ground and create a inbound rule to allow port 3000. Follow this guideline.
https://www.alibabacloud.com/help/doc-detail/25471.htm
Make sure you allow TCP traffic or all traffic from all sources to the port 3000 as the inbound rule.
The fact that you can access your service locally - but not publicly could mean 2 possible configurations:
The server running your application has blocked the port 3000
You have not configured your server to map the port 80 of a specific route to the port 3000
It is highly possible that a most essential part of your server configuration has not been done.
Here's my situation: I followed this tutorial to host my website using Bitnami MEAN-Image on an Amazon EC2 instance - https://scotch.io/tutorials/deploying-a-mean-app-to-amazon-ec2-part-1. Then, I bought a domain name and set up my elastic IP address on my EC2 instance, and I've linked the domain and instance. If I run my app on port 3000 (npm start), I can see the app by going to mydomain.com:3000, but if I run my app on port 80, or if I don't run my app at all then I am taken to the default Bitnami MEAN page when I go to mydomain.com or mydomain.com:80. How do I get my app to appear on mydomain.com without specifying the port?
Editing to ask this; even without using my purchased domain name, is it possible to make my EC2 instance public dns default to my app's main page instead of defaultin to the Bitnami MEAN home-page?
If you have installed the Bitnami MEAN Stack, you will have your Apache server running on port 80, and it serves the default page located at /opt/bitnami/apache2/htdocs.
If you want Apache to serve your application by default, you can do it following the steps below:
Start your application in your port, for instance, the port 3000.
Go to your /opt/bitnami/apache2/conf/bitnami/bitnami.conf and add the following lines within your default Virtual Host configuration. It should look like this:
<VirtualHost default:80>
...
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
...
</VirtualHost>
Now, you should be able to access your application at http://your-ip/
You have to redirect your port 80 to 3000 so whenever they enter the domain or the ip, it gets to port 80.
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
use this and this should redirect the port 80 calls to 3000