Question

Why I need include port with the domain/ip ?

Hi, I just create a droplet using dokku and deploy a RoR app, the problem is that only with the ip addres the web app doesn’t open, the browser show this message “This webpage is not available”, only if I specify the port it work (e.g. 100.201.202.203:50000). I add a domain and its the same, only work with the port (e.g www.something.com:50000). Someone know why is this happening and how can I fix it?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

When you use a URL without a port included your browser assumes it is port 80 (or 443 for HTTPS). Using anything else requires it to be specified. Generally with modern apps using Rails, a JavaScript framework or something other than static HTML or PHP scripts you will use a reverse proxy web server in front of the app to process requests (this also automatically gives you nice standard access logs). What you can do is:

First install nginx

sudo apt-get update;
sudo apt-get install nginx;

Then once it’s installed, edit the nginx configuration file in /etc/nginx/sites-enabled/ so it reads like:

server {
        listen   80; 
        server_name example.com; 
        
     location / {      
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:50000;

     }
}

Then restart nginx:

service nginx restart