I need to connect a domain name with my nodejs application. I used Amazon aws ec2 instance and I run locally node project.
How can I connect my domain name to my nodejs application? I'm using a Windows Server with IIS.
I need to connect a domain name with my nodejs application. I used Amazon aws ec2 instance and I run locally node project.
How can I connect my domain name to my nodejs application? I'm using a Windows Server with IIS.
You can do this using Nginx Proxy Pass.
Ubuntu: sudo apt-get install nginx
Fedora/Centos: yum install nginx
Edit your config sudo nano /etc/nginx/sites-available/default
add these lines at the very bottom of your file:
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /your_nodejs_app_directory;
server_name your_domain_name.ex;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:7195;
}
}
remember to change:
/your_nodejs_app_directory
with your nodejs app directory
your_domain_name.ex
with a domain name that point to your server
:7195
with your NodeJS application port
reboot Nginx
sudo service nginx restart
Note that, if you are using a RedHat based distribution (like Fedora and Centos), you need to do:
/etc/init.d/nginx restart
or
/etc/init.d/nginx reload
to reboot Nginx. now you can see your NodeJS application by visiting your_domain_name.ex
IIS have a method nginx-like named ARR (Application Request Routing). See documentation Here.