oxen-io / session-pysogs

Python implementation of the Session community server
GNU General Public License v3.0
74 stars 33 forks source link

https://domain.tld SOGS install failed on Debian 11, SOGS proxied: Could not automatically find a matching server block ; Welcome to nginx! #146

Open slrslr opened 1 year ago

slrslr commented 1 year ago

I was installing sogs proxied https://github.com/oxen-io/session-pysogs/blob/dev/install-debs.md#installation on Debian 11 and selected address: https://mydomain.tld when prompted. After installed, accessing that address via browser not worked: Secure Connection Failed

sudo apt install python*certbot-nginx
sudo certbot --nginx -d mydomain.tld -d www.mydomain.tld

That attempt to install certificate always ended with error: Could not automatically find a matching server block for mydomain.tld. Set theserver_namedirective to use the Nginx installer.

I have found that certbot starts working after i "sudo nano /etc/nginx/nginx.conf" and setting

server {
    server_name  localhost mydomain.tld www.mydomain.tld;

and restarting nginx: sudo systemctl restart nginx && sudo nginx -t

After previous command, web browser shows: "Welcome to nginx!" not SOGS index. I have later solved this by messing with the nginx files :-/

So here i am wondering if sogs installation can somehow deal with nginx other way so admin does not have to face the certbot issue.

I was also missing instruction on how to uninstall sogs including all configs. https://github.com/oxen-io/session-pysogs/blob/dev/install-debs.md https://github.com/oxen-io/session-pysogs/blob/dev/install-uwsgi.md

I did the same for nginx: sudo apt purge nginx;sudo apt install nginx;sudo apt-get -o DPkg::options::=--force-confmiss --reinstall install nginx-common Before i attempt to "sudo apt install sogs-proxied" (this time it ended with no prompts despite i have apt remove the package before install and removed also /var/lib/session-open-group-server , /etc/sogs/sogs.ini

Ideas how to cleanup the nginx/sogs installation and make it working with nginx and certbot are needed. I am not using nginx for anything else beside sogs.

jagerman commented 1 year ago

Upon installation of the sogs-proxied package you should have a:

/etc/nginx/sites-available/sogs-proxy

set up for sogs, and a symlink to this in /etc/nginx/sites-enabled/sogs-proxy that activates it. Can you check that those files are present and contain the correct domain?

slrslr commented 1 year ago

Can you check that those files are present and contain the correct domain?

Unfortunately i am unable to answer this question as i do not remember how it was, but i remember that when it was not working (as described) i was trying various things including symlink in available/enabled folders and possibly removing from these folders to prevent possible conflict with nginx.conf in myin folder where i ended up manually (unfortunately) defining things. So i do not know. But i can try to reinstall if you think it is necessary to know about the symlink (i hope no since it is not easy for me to backup things, find out right commands).