Control Web Panel

WebPanel => Apache => Topic started by: MeNICenT on December 04, 2022, 08:10:04 PM

Title: Way to set http and https on other ports as 80 and 443 ?
Post by: MeNICenT 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
Title: Re: Way to set http and https on other ports as 80 and 443 ?
Post by: overseer 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