How use only http://hostname/ instead of http://hostname:1880/ui


I'm trying to use only http://hostname/ instade of http://hostname:1880/ui

I instaled the nginx and configured the file node-red with :

sudo nano /etc/nginx/sites-available/node-red

with the following code

server {
listen 80;
server_name hostname;

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

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

location /phpmyadmin {
    alias /usr/share/phpmyadmin;
    index index.php;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;


but it only works if I use port 8080 and http://hostname:8080/
When I use port 80 it doesn't work. I tried accessing with http://hostname, http://hostname:80

I stopped and disabled Apache. But the problem persists.

It seems that port 80 is being used by some service and does not allow nginx to use port 80.

Does anyone have an idea of how to solve or alternative?

additional information:
Raspberry Pi 4B (Raspberry OS 64 bits)
installed Node-Red and LAMP (Linux, Apache, MySQL, PHP)

Thank you

Why are you running both? They do the same thing. And NGINX is significantly more efficient than Apache.

You need to find out what. Not a good idea to leave unknown ports active anyway, what if it is malware?

Find out what is using it and kill it off or reconfigure it to use a different port. Then use NGINX to proxy everything.

Thank you
He didn't know they both did the same.

I managed to solve it using Apache :slight_smile:

I added it to the 000-default.conf file

sudo nano /etc/apache2/sites-available/000-default.conf

and added the following lines:

    SetEnvIf Host ^(.*)$ HOSTNAME=$1

    RewriteEngine On
    RewriteCond %{ENV:HOSTNAME} ^(.*)$
    RewriteRule ^/$ http://%1:1880/ui [L,R]
    ProxyPass /node-red http://%1:1880
    ProxyPassReverse /node-red http://%1:1880

    #redireccionar para o phpmyadmin
    Alias /phpmyadmin /usr/share/phpmyadmin
    <Directory /usr/share/phpmyadmin>
            Options SymLinksIfOwnerMatch
            DirectoryIndex index.php

now with other PCs I already have access to the Node-Red Dashboard using just http://hostname/

thank you again !


@JorgeTorres01 Well done :slight_smile:

Just to make sure:

  • You are not doing this on an open Webserver do you?
  • without using SSL, basic-auth, reverse proxy, etc...
  • only on a local subnet or using VPN !

Right ?

Opening NR to the WWW without properly securing it first is IT server-suicide, or worse.