Admin Level -> Custom HTTPD Configuration -> cp.domain.com
and in the top |CUSTOM| token textarea, we'll insert:|*if SSL_TEMPLATE="1"|
|?HAVE_PHP1_FCGI=0|
|?HAVE_PHP2_FCGI=0|
|?HAVE_PHP1_FPM=0|
|?HAVE_PHP2_FPM=0|
|?CLI=0|
|?HAVE_PHP1_CLI=0|
|?HAVE_PHP2_CLI=0|
|?SUPHP=0|
|?HAVE_PHP1_SUPHP=0|
|?HAVE_PHP2_SUPHP=0|
ProxyRequests off
SSLProxyEngine on
ProxyPass /phpmyadmin !
ProxyPass /phpMyAdmin !
ProxyPass /webmail !
ProxyPass /roundcube !
ProxyPass / https://server.hostname.com:2222/
ProxyPassReverse / https://server.hostname.com:2222/
#ProxyPreserveHost On
|*else|
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/.well-known
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|*endif|
cd /usr/local/directadmin
./directadmin set x_forwarded_from_ip 1.2.3.4
./directadmin set check_referer_port 0
cd /usr/local/directadmin/data/templates
cp virtual_host.conf custom
cd custom
ProxyRequests Off
ProxyPass / http://127.0.0.1:2222/
ProxyPassReverse / http://127.0.0.1:2222/
To the end of the virtual_host.conf file, just after the virtualhost that is already there. (Yes, there will be 2 in one file). Repeat this for the other files if you copied them (but use 443 for the ssl version, with the ssl related options). If this is apache 2, you may need to add "SSLProxyEngine on" into the virtualhost if you are using DA with SSL.
3) Skip this step with apache 2.4.
Enable mod_proxy in your /etc/httpd/conf/httpd.conf file. Edit that file and uncomment the followig lines (remove the # character)
LoadModule proxy_module modules/libproxy.so
AddModule mod_proxy.c
Note that if you have mod_proxy compiled into your httpd binary (with apache 2), you only need to add the AddModule entry. To check your httpd binary, type:/usr/sbin/httpd -l
and look for the mod_proxy bits.echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
cd /usr/local/directadmin/data/templates
cp dns_a.conf custom
cd custom
echo "cp=|IP|" >> dns_a.conf
|?HOSTNAME=yourhost.com|
at the very top of /usr/local/directadmin/data/skins/enhanced/header.html so that it overwrite the previous setting of "localhost". Another method would be to use "ProxyPass / http://yourhost.com:2222/" instead of "ProxyPass / http://localhost:2222/".server {
listen 1.2.3.4:80;
server_name cp.domain.com;
include /etc/nginx/webapps.conf;
location / {
proxy_pass http://server.hostname.com:2222/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect http://cp.domain.com:2222/ http://cp.domain.com/;
}
}
/etc/nginx/nginx-includes.conf
and restart nginx.|*if SSL_TEMPLATE="1"|
|?HAVE_PHP1_FCGI=0|
|?HAVE_PHP2_FCGI=0|
|?HAVE_PHP1_FPM=0|
|?HAVE_PHP2_FPM=0|
|?CLI=0|
|?HAVE_PHP1_CLI=0|
|?HAVE_PHP2_CLI=0|
|?SUPHP=0|
|?HAVE_PHP1_SUPHP=0|
|?HAVE_PHP2_SUPHP=0|
RewriteEngine On
#RewriteCond %{REQUEST_URI} !^/?(phpmyadmin|phpMyAdmin|webmail|roundcube|)/
RewriteRule ^(.*)$ https://cp.|DOMAIN|:2222/$1 [P,L]
|*else|
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/.well-known
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|*endif|
[REWRITE] Proxy target is not defined on external application list, please add a 'web server' with name 'https://cp.domain.com:2222
then you'll need to add an approved proxy web server in your LSWS panel login:Configuration -> Server -> External App -> Add
for each host that will connect to DA. Should we find some way to override the "Host" value sent to LSWS from the redirect, then the value in the template could be unified, saving the need to load up everyone's cp.|DOMAIN| in the LSWS admin area. You'l also need to hit the "graceful reload" option after changing things.Checking referer https://server.hostname.com/ to server.hostname.com:2222
Referer port (443) does not match DA's (2222): https://server.hostname.com/