Question

I have recently set up a shiny server account on AWS. I have an elastic ip in the format xx.xxx.xxx.xxx but I need to add the port number :3838 to view it on the web

I wish to associate a dns name mywebsite.com with the elastic ip but obviously do not want to have a user add :3838 each time. I tried, with go daddy, associating the name with elastic ip+:3838 but that is invalid

TIA

Was it helpful?

Solution 2

If you work on ubuntu you can use iptables

sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3838

This will route all traffic coming from port 80 to port 3838

OTHER TIPS

You have to setup a reverse proxy on your server. You can do it with Apache or nginx.

With Apache you can add something like this in your configs:

<VirtualHost *:80>
            ProxyPass / https://127.0.0.1:3838/
            ProxyPassReverse / https://172.0.0.1:3838/

</VirtualHost>

With nginx:

server {
    listen       80;
    server_name  myserver.com;

    location / {
        proxy_pass  http://127.0.0.1:3838;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header        Host            static.example.com;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top