Author Topic: BUG: Nginx Vhosts created with shared IP when set to other IPs  (Read 5405 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
This is on an AWS server, created on the the latest Centos base AMI.

My webservers are setup as:
HTTP: Nginx (80) --> Varnish (82) --> Apache (8181)
HTTPS: Nginx (443) --> Varnish (82) --> Apache (8181)

We have added two elastic IPs and they both show up on the command line as private IPs:

172.31.44.10
172.31.36.240



In CWP Settings > Edit Settings, I have set the primary Elastic IP as the shared IP and the corresponding private IP as the Nat Local IP.  I have also checked off the Activate NAT-ed network configuration:



The result is that everything seems to work correctly when using the shared Elastic IP. 

This issue is when I go to make a new account link so:
 


If I select the shared IP or the corresponding private IP (172.31.44.10) everything works as expected.  If I select the other IP address (172.31.36.240) all http connections to the new account are refused.  After much debugging, I found the issue was that in the nginx conf file (/etc/nginx/conf.d/vhosts/DOMAIN.conf), the new vhosts are all being set to the shared IPs private address despite the fact that the account is set to use a different IP address. Manually editing this file to be the selected private IP address for the account and restarting nginx corrects the issue.

Is there something I am doing incorrectly here?  Is there anything that can be done so that I don't have to manually edit the vhosts file for each new account created that isn't using the shared IP?

Thanks for any/all help you guys might be able to provide!

Cheers,

Ajar

Re: BUG: Nginx Vhosts created with shared IP when set to other IPs
« Reply #1 on: July 08, 2020, 10:52:38 AM »
This doesn't surprise me. There's a related bug when shared IP doesn't match the main server IP: access to user accounts from CWP uses the wrong IP. It looks as though domain mapping would be more reliable than using the IP, for more than one aspect of the control panel.
For now, I just manually reassign the user IP, rather than the wrong shared IP. Fine if there's only a few accounts but tedious nonetheless.

Offline
*
Re: BUG: Nginx Vhosts created with shared IP when set to other IPs
« Reply #2 on: July 08, 2020, 12:28:45 PM »
And today I've realized that if you do any changes that trigger the .conf files be rebuilt, you must manually edit each of the domains conf files again.  Ugh! Now that is a pain.

And it isn't just the Ngnix conf that has the wrong ip.  All conf files for all three are incorrect:

/usr/local/apache/conf.d/vhosts
/etc/varnish/conf.d/vhosts
/etc/nginx/conf.d/vhosts

I've reviewed the vhost templates and unfortunately it appears to be more than just a wrong variable in the templates.  The IP address gets inserted by the %ip% variable, which must be set somewhere before the template is parsed and it's being set incorrectly.


Best regards,

Ajar
« Last Edit: July 08, 2020, 12:42:32 PM by ajar »

Offline
*
Re: BUG: Nginx Vhosts created with shared IP when set to other IPs
« Reply #3 on: July 17, 2020, 04:55:45 PM »
Quote
And today I've realized that if you do any changes that trigger the .conf files be rebuilt, you must manually edit each of the domains conf files again.  Ugh! Now that is a pain.
I reported this bug two years ago  ::)

What's the point of being able to specify specific IP's for each user/domain if that info is not being used when CWP rebuilds the vhosts?

Come on Devs... Please fix this.

If anyone reading this post has a support contract with CWP, please open a ticket for this.

Offline
*
Re: BUG: Nginx Vhosts created with shared IP when set to other IPs
« Reply #4 on: January 11, 2021, 12:29:49 PM »
I'm experiencing this same issue. Has anyone found a fix for this, currently I have to manually edit all the vhosts.