How To Set Up Default Port?

We have our company website which runs on nodejs framework Sails, within Port :2000 We hired a private DNS ( ) And apache is currently redirecting to our DO Ip ( ) but on the browser it’s visible the IP instead of the URL name for the website, we’re from brazil, so the company that sells domains which we registered is called ( )

I’d like to know which configuration should be done in order for the website show it’s correct name using the port 2000 as default whenever an user access our domain.

Thanks in Advance, best regards!

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.

This comment has been deleted

Hey, great question!

It looks like you’re currently using a redirect rather than a reverse_proxy so users are actually redirected to port 2000 on your IP. This may cause problems for users that are behind restrictive firewalls.

This section of the official documentation covers how to set up a reverse proxy configuration on Apache.

Personally I find it easier to work with Nginx for this purpose than Apache but this is in part, a matter of preference. I have several of my services which are written in Ruby and other languages running behind nginx in this fashion.

If you’d like to try this configuration instead you can follow the steps below.

1.) Remove Apache

apt-get update
apt-get remove apache2

2.) Install NGINX

apt-get install nginx

3.) Open the default configuration file /etc/nginx/sites-enabled/default and modify it so it looks like this:

server {

        listen 80default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
        proxy_pass http://localhost:2000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;


4.) Restart nginx for the change to take effect:

service nginx restart

Your service running on port 2000 should now be viewable as without the IP or port shown in the address bar. All traffic will pass over port 80 rather than directing the user themselves to port 2000.