mjl- / mox

modern full-featured open source secure mail server for low-maintenance self-hosted email
https://www.xmox.nl
MIT License
3.38k stars 89 forks source link

How to expose the web server onto the internet? #93

Closed zigomi closed 8 months ago

zigomi commented 8 months ago

Instead of having running

ssh -L 8080:localhost:80  root@11.22.33.44

how to expose the built-in server onto the internet? Does mox support it or will I have to run nginx as reverse proxy?

Also, what's the root route http://localhost/ for? There're http://localhost/admin and http://localhost/webmail for which mox generates the credentials. But for the root path - not.

mjl- commented 8 months ago

There are various options:

The route http://localhost/ is for the "account" page. Where a user/account can import/export messages, change their display name, change rules for delivering incoming messages into certain mailboxes, etc. I plan to merge the account page into the webmail (but there are things higher up on the todo list). The account endpoint is configured through AccountHTTP(S) in a Listener in config/mox.conf. See this snippet:

Account web interface, for email users wanting to change their accounts, e.g.

set new password, set new delivery rulesets. Served at /. (optional)

AccountHTTP: Enabled: true

zigomi commented 8 months ago
  • Expose the admin/account/webmail functionality on the public listener, making it available on the public IP. You would have to modify config/mox.conf, move/copy some of the {Webmail,Admin,Account}HTTP(S) settings from the internal listener to the public listener.

It'll be http only, right? Apart from nginx as a reverse proxy, the 3rd option, can mox make it https on its own? Namely, with existings https websites on the same server.

The route http://localhost/ is for the "account" page. Where a user/account can import/export messages, change their display name, change rules for delivering incoming messages into certain mailboxes, etc.

Ok, but neither the admin, nor the mailaccount credentials work on it. Or should it be ignored, since you'll be merging it?

mjl- commented 8 months ago

It'll be http only, right? Apart from nginx as a reverse proxy, the 3rd option, can mox make it https on its own? Namely, with existings https websites on the same server.

For the Admin, Account and Webmail interfaces, you can enable HTTPS as well. Instead of AccountHTTP, use AccountHTTPS, and likewise use AdminHTTPS and WebmailHTTPS. That should expose those services on HTTPS.

Ok, but neither the admin, nor the mailaccount credentials work on it. Or should it be ignored, since you'll be merging it?

Oh, that is surprising. The account password should work. Are you logging in with an email address + password? Logging in with the account name as username won't work. That's still somewhat misleading, though the authentication-failed error message does mention that you need to use the email address of the account (or are you not getting that error message? e.g. if you hit escape in the HTTP password popup).

zigomi commented 8 months ago

All good now.