Apache or Nginx Reverse Proxy

January 30, 2018 874 views
Apache Nginx Ubuntu 16.04

I have Ubuntu 16.04 LTS vps on a vps provider (linode). Also domain name as yildiziot.com

I am doing some test and trying to learn.

I have installed node-red on that vps. A while ago i can access with yildiziot.com:1880. But now i cant.

I have also installed emq on the same server.

What i am trying to do, when i type from any web browsers address bar "node-red.yildiziot.com" i need to get node-red page ( if it is possible, i like to enter user name and password).
When i type mqtt.yildiziot.com i need to get emq's dashboard page so i can make some changes.

Also node-red.yildiziot.com/map should open map, /dashboard should open node-red dashboard.

I realy tried so many things. In my country it is 02:17 am right now. But i do not know what i did.

What should i do?

2 Answers

Here's an example of nginx config to reverse proxy a node-red server (websocket support)

server {
  listen 80;
  server_name your_server_name;

  access_log /var/log/nginx/access.log;

  location / {
    proxy_pass http://localhost:1880;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}

I will try this right away. But i have an another question.

If i want to publish my web sites (more than one. they are subdomains and about 4 or 5 pcs), do i need conf file for each web sites?

Have another answer? Share your knowledge.