Web GUI Port change

Hi there

I’d like to change the GUI port from 80, so I can use Nginx Proxy Manager; does anyone know how to go this?

Hi,

I’ve recently been tinkering around with Nginx Proxy Manager as well and this is what I found out so far:

Note: This is no a permanent solution (yet). After a reboot your NAS will default back.

Edit config to custom HTTP port.

The WD web interface runs at ports 80 and 8443 by default.

Open up an SSH session to your My Cloud NAS

To move it to another port, e.g. 8080 and 8443, you may use these commands.

vi /etc/nasAdmin.toml

and change following line to another port:
[ports] httpPort = 80 […]

Stop the WD web interface

Kill the WD Dashboard interface Apache web service running on port 80.

Kill the nasAdmin process occupying port 80

pkill nasAdmin
Additionally maybe required sometimes:
pkill httpd

Ensure ports 80 and 443 are free. No process may occupy these ports.

netstat -tulpn | grep -E '80|443'

Start NginxProxyManager

Start your NginxProxyManager Installation

Docker Container?
docker start nginxproxymanager

Restore WD web UI

Start the WD Dashboard again.
It will run under the port defined earlier.

cd /sbin
nasAdmin

Hi there

Thank you for taking the time to post this, I was very excited to try it out!

BUT unfortunately having followed your method to the letter, when I deploy an NPM container and open a browser, I get ERR_CONNECTION_REFUSED.

Portainer tells me that all is well and NPM is running on port 80, but no dice!

What do you get when you run following commands?

netstat -tulpn | grep -E ':80 |:443 '
docker ps | grep -E ':80-|:443-'

For the netstat I get:

tcp 0 0 0.0.0.0:39871 0.0.0.0:* LISTEN 7802/rpc.mountd
tcp 0 0 192.168.1.127:49153 0.0.0.0:* LISTEN 24806/upnp_nas_devi
tcp 0 0 0.0.0.0:9443 0.0.0.0:* LISTEN 10304/docker-proxy
tcp 0 0 0.0.0.0:37475 0.0.0.0:* LISTEN 7802/rpc.mountd
tcp 0 0 0.0.0.0:56133 0.0.0.0:* LISTEN 7802/rpc.mountd
tcp 0 0 0.0.0.0:54351 0.0.0.0:* LISTEN 7804/rpc.statd
tcp6 0 0 :::49152 :::* LISTEN 24806/upnp_nas_devi
tcp6 0 0 :::8080 :::* LISTEN 18201/nasAdmin
udp 0 0 127.0.0.1:772 0.0.0.0:* 7804/rpc.statd
udp 0 0 0.0.0.0:37716 0.0.0.0:* 7802/rpc.mountd
udp 0 0 0.0.0.0:1900 0.0.0.0:* 24806/upnp_nas_devi
udp 0 0 0.0.0.0:36797 0.0.0.0:* 7804/rpc.statd
udp 0 0 0.0.0.0:55350 0.0.0.0:* 7802/rpc.mountd
udp 0 0 0.0.0.0:49215 0.0.0.0:* 7802/rpc.mountd
udp 0 0 127.0.0.1:45510 0.0.0.0:* 24806/upnp_nas_devi
udp 0 0 192.168.1.127:42476 0.0.0.0:*

For the docker command, nothing happens!

This is good, the Web GUI is now on port 8080 and doesn’t allocate port 80.

Which command do you run to start the NPM container?

You need to specify to the container to expose to port 80 using -p 80:80

My example

docker run --detach \
  --publish 80:80 --publish 81:81 --publish 443:443 \
  --name npm \
  --restart always \
  jc21/nginx-proxy-manager:latest 

Great! I was installing NPM via Portainer and it seemed wobbly - using your method via SSH access was much better, now it runs for me, thanks a mill!

Now the next step is to get retention of the GUI port across a reboot, do you think that this is possible?

Yeah, Portainer is wobbly if it gets more advanced, especially with the WD NAS.

Regarding a persistent solution to free the GUI port:
This is more like a hack than a proper solution but it works and is easy:

I have appended the commands to free port 80 and start NPM into the Docker application script files.

You can find these under /mnt/HD/HD_a2/Nas_Prog/docker/

It can be any application installed on your NAS and activated in the Dashboard, but it made sense for me to include it in the Docker path.

Background: As soon as your NAS boots, it will start the applications by running the script files and execute the commands.

I have added the custom commands inside file daemon.sh under the function function docker_setup.
Open the file in a text editor and look for that function.

[…]
function docker_setup
{
    is_docker_setup && return 0

    echo "Setting up docker"

    # Free GUI Port and start NPM
    pkill nasAdmin
    docker start nginxproxymanager 

[…]

:whale2:

Thanks for this, but after a reboot the NAS has changed its nasAdmin.toml file back to port 80.
Is there a way of keeping it on the new modified port?

Add this line before kill nasAdmin

sed -i 's/httpPort = 80/httpPort = 85/g' /etc/nasAdmin.toml

In this example the new port is 85.

Beautiful, all working correctly!

Thanks a million.

1 Like