spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.9k stars 1.04k forks source link

Cannot run matrix-nginx-proxy on port 443 #1294

Open sliwik opened 3 years ago

sliwik commented 3 years ago

Hello, When configuring matrix_federation_public_port: 443 in vars.yaml, I cannot start the service with following error message: Jun 10 11:18:08 debian systemd[1]: Started Matrix nginx-proxy server. Jun 10 11:18:10 debian matrix-nginx-proxy[11903]: docker: Error response from daemon: driver failed programming external connectivity on endpoint matrix-nginx-proxy (5199654cc3e373e3279c2626001eb1c175cd70f9884af4fd9bb6f663e7e9c02f): Bind for 0.0.0.0:443 failed: port is already allocated. Jun 10 11:18:10 debian systemd[1]: matrix-nginx-proxy.service: Main process exited, code=exited, status=125/n/a Jun 10 11:18:10 debian systemd[1]: matrix-nginx-proxy.service: Failed with result 'exit-code'.

Running netstat -tulpn | grep :443 shows: tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 7572/docker-proxy tcp6 0 0 :::443 :::* LISTEN 7591/docker-proxy

Is there any other service the Playbook is running with port 443 ? (I don't have any docker other than matrix ones).

bloodyburger commented 3 years ago

The error says port in use, can you see what is using 443 sudo netstat -tulpn | grep LISTEN

Happyfeet01 commented 3 years ago

You have an other webserver running. like Nginx or apache

sliwik commented 3 years ago

The error says port in use, can you see what is using 443 sudo netstat -tulpn | grep LISTEN

So before starting any Matrix service the command shows:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      576/sshd
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      9360/cupsd
tcp6       0      0 :::22                   :::*                    LISTEN      576/sshd
tcp6       0      0 ::1:631                 :::*                    LISTEN      9360/cupsd

After starting the Matrix services with ansible-playbook -i inventory/hosts setup.yml --tags=start with #matrix_federation_public_port: 443 in vars.yaml, I can see port 443 is used but I don't know which docker service is using it as I haven't configured Federation to use it:

root@device1:~# netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      19079/docker-proxy
tcp        0      0 0.0.0.0:8448            0.0.0.0:*               LISTEN      19007/docker-proxy  
tcp        0      0 0.0.0.0:5349            0.0.0.0:*               LISTEN      19696/docker-proxy  
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      19125/docker-proxy  
tcp        0      0 0.0.0.0:3478            0.0.0.0:*               LISTEN      19738/docker-proxy  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      576/sshd            
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      9360/cupsd          
tcp6       0      0 :::443                  :::*                    LISTEN      19092/docker-proxy  
tcp6       0      0 :::8448                 :::*                    LISTEN      19019/docker-proxy  
tcp6       0      0 :::5349                 :::*                    LISTEN      19703/docker-proxy  
tcp6       0      0 :::80                   :::*                    LISTEN      19140/docker-proxy  
tcp6       0      0 :::3478                 :::*                    LISTEN      19746/docker-proxy  
tcp6       0      0 :::22                   :::*                    LISTEN      576/sshd            
tcp6       0      0 ::1:631                 :::*                    LISTEN      9360/cupsd 

Is any Matrix service supposed to use port 443 by default? Thanks.

Happyfeet01 commented 3 years ago

I had the problem few days back, that the nginx proxy from matrix won't stop. So i have the same problem as you. I killed the docker container and restart was possible.

sliwik commented 3 years ago

I still don't see how to have matrix_federation_public_port: 443 in vars.yaml and start the service without having the error message Bind for 0.0.0.0:443 failed: port is already allocated when nginx service starts

Happyfeet01 commented 3 years ago

Is there an other reverse proxy active?

sliwik commented 3 years ago

No other reverse proxy

luneth commented 1 year ago

Just bumping this issue as I am actually having the same problem.

Happyfeet01 commented 1 year ago

Just bumping this issue as I am actually having the same problem.

try to restart the Docker Service