Koozali.org: home of the SME Server

Change https port

Offline peterhocking

  • ****
  • 90
  • +0/-0
    • Welcome to the Hockings at Canberra
Change https port
« on: March 13, 2008, 12:42:13 PM »
Hi

Is it possible to change the https port from 443 to something else so the the current functionality is retained, ie. when I enter www.mydomain/webmail, I still get redirected to https://www.mydomain/webmail?

TIA

Peter  :-)

Offline zatnikatel

  • *****
  • 190
  • +0/-0
Re: Change https port
« Reply #1 on: March 25, 2008, 12:55:52 PM »
why do you want to change the port
as the the server-manager uses https as well it may break stuff

Offline mmccarn

  • *
  • 2,656
  • +10/-0
Re: Change https port
« Reply #2 on: March 26, 2008, 03:10:08 PM »
The webmail redirect is handled in /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/30WebmailAliases

If you want to change the redirect from "https://www.mydomain/webmail" to "https://www.mydomain:4443/webmail" you would need to customize this template fragment.

I would recommend implementing the "new" port using a port forwarding rule.

So, if your objective is to get your webmail redirect to use a port other than 443 from the public internet, your solution looks like this:

1) Setup a port forwarding rule that forwards port 4443 to port 443 on "localhost"
2) Verify that you can now access webmail at https://www.mydomain:4443/webmail
3) Modify the webmail "rewrite" rule by executing the following commands:
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts
sed s/"%{HTTP_HOST}"/"%{HTTP_HOST}:4443"/ \
 /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/30WebmailAliases > \
 30WebmailAliases
signal-event email-update

This re-direct will work correctly from OUTSIDE your network (or if you access your server from INSIDE using the WAN IP address), but will NOT work if you access your server by name or LAN IP from the LAN.