Help with Nginx/Apache as Reverse Proxy setup

iamgavinjones

New member
Joined
Jan 2, 2023
Messages
2
Hi everyone,

I am an absolute NOOB with DirectAdmin, I recently migrated my entire hosting portfolio over to a new VPS provider and they recommended I use DirectAdmin (I've been using Cpanel for years).

I have a scenario where I am needing to redirect portal.mydomain.com or mydomain.com/portal (not sure which is easier) to my CRM Server on a public IP with a specific port xxx.xxx.xxx.xxx:yyyy

As I'm new to DirectAdmin, I am petrified of breaking any of the sites I am hosting on my server.

Any assistance will be greatly appreciated - All I have done so far is follow these steps: https://docs.directadmin.com/webservices/nginx_apache/general.html
From what I can tell, it's been installed and I have no idea what to do from this point onwards.

I appreciate your time and efforts.
 
Hi Alex,

Many thanks for your response, would you be willing to implement it with me? I would be more than happy to pay you for your time. Can we chat directly?
 
I did,
And it apparently solved my problem.

Could you suggest me any not-so-simple way, In case of me or someone in dire need to have an actual subdomain in direct admin and do the thing mentioned by the article you stated?

Thank you for your time
 
I have the following added to my /usr/local/directadmin/data/templates/custom/virtual_host2_secure.conf.CUSTOM.4.post:

# DirectAdmin PANEL

<VirtualHost |IP|:|PORT_443| |MULTI_IP|>
ServerName panel.|DOMAIN|
ServerAdmin |ADMIN|


SSLEngine on
SSLCertificateFile |CERT|
SSLCertificateKeyFile |KEY|
|CAROOT|


#ProxyRequests off
SSLProxyEngine on
ProxyPass / https://127.0.0.1:2222/
ProxyPassReverse / https://127.0.0.1:2222/
ProxyPreserveHost On


CustomLog /var/log/httpd/domains/|DOMAIN|.bytes bytes
CustomLog /var/log/httpd/domains/|DOMAIN|.log combined
ErrorLog /var/log/httpd/domains/|DOMAIN|.error.log

This way, every domain gets a panel hostname which forwards to your DA on your DA port (2222 or whichever port you use) on 127.0.0.1

Hope this helps.
 
Oh and in /usr/local/directadmin/data/templates/custom/virtual_host2.conf:

## PANEL VirtualHost:

<VirtualHost |IP|:|PORT_80| |MULTI_IP|>
ServerName panel.|DOMAIN|
RewriteEngine On
RewriteRule "^/$" "https://panel.|DOMAIN|/"
</VirtualHost>
 
Back
Top