Search code examples
httpapache2listen

Apache not listening on port 256 with multiple sites


I have 3 sites.
One runs on port 80, one runs on port 1337, and one runs on port 256.

I created both of the first two with just command line utils and the last one, the one that isn't working, from webmin on a chromebook. The server is being hosted on a Raspberry Pi 3 and none of the sites have too high of a memory limit (only about 100MB).
The last site, the one running on port 256, isn't functioning properly. It returns an ERR_CONNECTION_REFUSED error in Google Chrome and I don't currently have the ability to check on the Pi itself. I have restarted Apache and the Pi.

What am I doing wrong? I'm using Apache2 and I'm signed in as root.

UPDATE: In Webmin, after running wget localhost:256, I've encountered this error:

    --2021-01-13 10:25:43--  http://localhost:256/
    Resolving localhost (localhost)... ::1, 127.0.0.1
    Connecting to localhost (localhost)|::1|:256... failed: Connection refused.
    Connecting to localhost (localhost)|127.0.0.1|:256... failed: Connection refused.

It's not just an issue with my laptop. This is an Apache configuration problem, it appears.

ANOTHER UPDATE: Here's the configuration file:

    <VirtualHost _default_:256>
        DocumentRoot /var/www/wiki
        <Directory "/var/www/wiki">
            allow from all
            Options None
            Require all granted
        </Directory>
    </VirtualHost>

Solution

  • Make sure apache is listening on the ports. You can use netstat:

    netstat -tupan | grep -i listen
    

    If the 3 ports are liste, the problem might be elsewhere.

    If a port is missing, check if httpd.conf contains this line:

    Listen 256
    

    If it does, check error logs for some error that will help you find what's wrong.