We have our company website which runs on nodejs framework Sails, within Port :2000 We hired a private DNS ( www.thundersolucoes.com.br ) And apache is currently redirecting to our DO Ip ( 104.131.25.124:2000 ) 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 Registro.br ( https://registro.br/ )
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!
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!
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 www.thundersolucoes.com.br 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.
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.