跳到主要内容

Not using 80/443 ports?

Sometimes after you initialize and start a blocklet server and find that the server is not using 80/443 ports, this may happen for several reasons:

  • The user creating/starting the server does not have permission to listen on 80/443 ports
  • The ports are being used when initializing the server.

So the solution to different causes should be straightforward:

1. Ensure your server has permissions for 80/443 ports

If you setup and run your @blocklet/cli and node.js as root, you usually do not need to do this, but if you want a non-root user to start a server instance, you need to make sure nginx or node are allowed to listen on 80/443, checkout the following post:

Allow non-root process to bind to port 80 and 443?

2. Ensure 80/443 ports are not occupied by other service

Most web server software such as Apache and Nginx may choose to start on system boot, and they usually occupies 80/43 ports, if you are not running any useful services behind the default web server software, please remember to disable them:

Nginx - disable autostart

3. Ensure 80/443 ports are picked up by blocklet server

Once you have fixed the permission issue and made the ports available for blocklet server, you can now tell blocklet server to use the expected ports:

  • rm ~/.arcblock/abtnode/*-preferred-ports.json ensure that newly created servers use 80/443
  • update .blocklet-server/config.yml by changing node.routing.httpPort and node.routing.httpsPort to 80 and 443

Then run blocklet server start -u to pickup the above config.