Run Node JS Project Without Port in URL

We can remove PORT from URL in Node JS project from server configuration files




So we have mainly two types of server base:
  1. Nginx
  2. Apache
Ubuntu - Node JS


For both we generally have /etc/nginx/default OR /etc/apache2/default file.

So you have to edit it manually which you can do via below steps:

1. Firstly go into nginx/apache2 directory 

Then,

Run command:
~ sudo nano default

configuration file will open in edited mode from which you can edit now

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    location {
        proxy_pass http://yourdomain.com:3000;
        #try_files comment this line manually via adding #
    }
}

Restart your server via nginx/apache2

~ sudo service nginx restart
~ sudo service apache2 restart 


That's it now check http://yourdomain.com this will also work same.

Happy Coding !!

Comments

Popular posts from this blog

JavaScript Logical Output Based Interview Questions

Create and Deploy AWS SAM Application

Deploy Angular Build With Express JS Project