Author Topic: Way to set http and https on other ports as 80 and 443 ?  (Read 1643 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Way to set http and https on other ports as 80 and 443 ?
« on: December 04, 2022, 08:10:04 PM »
In the apache templates there are placeholders like
PORT_REPLACE
and
%web_ssl_port%
but I can't find where these are defined
(The intention is to change the standard apache on non-standard port as the CWP-servers will be behind a Caddy or HA loadbalancer)
Thanks

Offline
*****
Re: Way to set http and https on other ports as 80 and 443 ?
« Reply #1 on: March 05, 2023, 04:08:53 AM »
A cleaner way might be with iptables; I've done this on a cPanel server before:
nano /etc/sysconfig/iptables
Add:
Code: [Select]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

-A INPUT ! -i lo -p tcp -m conntrack --ctstate NEW -m tcp --dport 8080 -j ACCEPT

COMMIT

-A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-ports 80

COMMIT
Then save & restart:
Code: [Select]
iptables-save
systemctl restart iptables