Control Web Panel

WebPanel => Apache => Topic started by: rklendes on January 01, 2022, 04:34:42 AM

Title: Conf files reset problem
Post by: rklendes on January 01, 2022, 04:34:42 AM
Hi,

I am editing and using vhost conf files (/usr/local/apache/conf.d/vhosts) of some websites on my server. However, on certain dates, all conf files are reset and all the edits I have made are deleted.

What task triggers this reset? How can I disable this?

(https://i.ibb.co/4SyQbPH/conf-files.jpg)

Thanks in advance for your help.
Title: Re: Conf files reset problem
Post by: Netino on January 01, 2022, 10:36:37 PM
Hi,

I am editing and using vhost conf files (/usr/local/apache/conf.d/vhosts) of some websites on my server. However, on certain dates, all conf files are reset and all the edits I have made are deleted.

What task triggers this reset? How can I disable this?
(image)
Thanks in advance for your help.

You must avoid to change directly the vhosts/*.conf files.
They will always overwritten always the webservers must be rebuilt.
I a recent update of CWP was needed to rebuild the webservers.
Instead of to change directly the vhosts conf files, you must create additional custom templates, simply copying and change them.
After that, you must apply the customized template to you site in CWP, "WebServers Domain Conf".

If you customize your webserver configuration, you *must* customize too the webserver templates in "/usr/local/cwpsrv/htdocs/resources/conf/web_servers/", otherwise, they will always be overwritten when CWP is updated.
(check there your webservers files used)

The templates per-si are *always* overwritten when CWP is updated too. So, you *must* to create additional files in that directories, instead to change it.
Copy an existant file, change the name of the file, one for .conf and another for .ssl.conf (always two files, obligatorily). This is needed to the template is showed in the "WebServers Domain Conf".

One way to avoid this customization above (in webserver templates) is to create your custom files directly in 'conf.d' diretories of your webservers, avoiding to change the system config webserver files. You can use it, if possible.

The triggers are the rebuild of the WebServers.
Possibly, the update_cwp routine now is rebuilding the Webservers daily.
It is in a cron file: /etc/cron.daily/cwp

Regards,
Netino
Title: Re: Conf files reset problem
Post by: rklendes on January 02, 2022, 09:17:44 AM
Hi,

I am editing and using vhost conf files (/usr/local/apache/conf.d/vhosts) of some websites on my server. However, on certain dates, all conf files are reset and all the edits I have made are deleted.

What task triggers this reset? How can I disable this?
(image)
Thanks in advance for your help.

You must avoid to change directly the vhosts/*.conf files.
They will always overwritten always the webservers must be rebuilt.
I a recent update of CWP was needed to rebuild the webservers.
Instead of to change directly the vhosts conf files, you must create additional custom templates, simply copying and change them.
After that, you must apply the customized template to you site in CWP, "WebServers Domain Conf".

If you customize your webserver configuration, you *must* customize too the webserver templates in "/usr/local/cwpsrv/htdocs/resources/conf/web_servers/", otherwise, they will always be overwritten when CWP is updated.
(check there your webservers files used)

The templates per-si are *always* overwritten when CWP is updated too. So, you *must* to create additional files in that directories, instead to change it.
Copy an existant file, change the name of the file, one for .conf and another for .ssl.conf (always two files, obligatorily). This is needed to the template is showed in the "WebServers Domain Conf".

One way to avoid this customization above (in webserver templates) is to create your custom files directly in 'conf.d' diretories of your webservers, avoiding to change the system config webserver files. You can use it, if possible.

The triggers are the rebuild of the WebServers.
Possibly, the update_cwp routine now is rebuilding the Webservers daily.
It is in a cron file: /etc/cron.daily/cwp

Regards,
Netino

First of all, thank you very much for your help.

As I understand it;

I created a template via WebServers Template Editor. I associated it with the relevant website via WebServers Domain Conf and rebuild the vhosts file. Everything looks normal now.

When an update is released, the vhosts file will be created over the template I specified, so I will not have the same problem. I hope I understood correctly.

Best regards.
Title: Re: Conf files reset problem
Post by: studio4host on January 02, 2022, 02:46:58 PM
you need to create your own new vhost template and you will not have issue.
http://wiki.centos-webpanel.com/webservers-vhost-templates
Title: Re: Conf files reset problem
Post by: writerguyfl on January 03, 2022, 09:31:29 AM
I sincerely appreciate all the people offering advice.  Unfortunately, nothing is working.  Every night between 3am and 4am (my time), all of my websites get knocked offline with the "Suspended Account" message.

I tried setting up custom vhost templates but the problem just happened again.

The following advice provided does fix the problem, but it doesn't "stick" and I have to repeat it every night:
Code: [Select]
/scripts/update_cwp
rm -f /usr/local/cwp/users/suspended/*.bandwidth
/scripts/cwp_api webservers rebuild_all

Honestly, I'm exhausted from having to be awake at 3am for the past four nights just to keep my websites online.  So, it's certainly possible that I did something wrong when I set up the vhost files.

As I noted elsewhere, I've been using CWP Pro for years.  I've never had to make changes to my servers any time an update happened...let alone needing to do it every single night just to stay online.

The lack of guidance and a permanent fix from the folks running CWP is rather shocking.
Title: Re: Conf files reset problem
Post by: gotracker on January 03, 2022, 10:29:10 AM
I opened a ticket with CWP support right now and I wrote them:
" I do not understand why was all working great and fine for years with your CPW (and I never modified any Vhost configuration in my server), and now starting from 30th of december 2021 all the nights between 3am and 4am all my customized conf files are resetting to default."
and they answered me:
"yes because of CWP security and integrity and hardened and improved quota system, from this point the CWP files will get reset on every update and to retain the user side changes you've to have templates.
Regards"
Title: Re: Conf files reset problem
Post by: kadybee on January 03, 2022, 01:54:31 PM
Not going to solve your problems but could help your sleep:

I have adjusted /etc/anacrontab to have:

START_HOURS_RANGE=9-22

That way it won't run in the middle of the night with surprise alarms or errors before you are in the office!  I think the standard is hours "3-22"  thus your 3-4am wake up call.

Title: Re: Conf files reset problem
Post by: studio4host on January 03, 2022, 03:49:50 PM
the main issue many do wrong is by editing vhost files directly.
You can't do that! If you plan to do something custom then you need to make own custom vhosts templates.

Info
http://wiki.centos-webpanel.com/webservers-vhost-templates
Title: Re: Conf files reset problem
Post by: writerguyfl on January 03, 2022, 07:49:00 PM
I opened a ticket with CWP support right now and I wrote them:
" I do not understand why was all working great and fine for years with your CPW (and I never modified any Vhost configuration in my server), and now starting from 30th of december 2021 all the nights between 3am and 4am all my customized conf files are resetting to default."
and they answered me:
"yes because of CWP security and integrity and hardened and improved quota system, from this point the CWP files will get reset on every update and to retain the user side changes you've to have templates.
Regards"

Thank you for sharing.  I do appreciate it.

This makes me absolutely enraged.  They make a fundamental change that completely alters the way CWP works without notifying their clients in advance.  Then, they seem to not care that they created a massive ongoing problem for some of us.

Not going to solve your problems but could help your sleep:

I have adjusted /etc/anacrontab to have:

START_HOURS_RANGE=9-22

That way it won't run in the middle of the night with surprise alarms or errors before you are in the office!  I think the standard is hours "3-22"  thus your 3-4am wake up call.

Thank you.  I'll look at this.  I've literally not had any "normal" sleep since this debacle started.

the main issue many do wrong is by editing vhost files directly.
You can't do that! If you plan to do something custom then you need to make own custom vhosts templates.

Info
http://wiki.centos-webpanel.com/webservers-vhost-templates

I'm not like many of you in that I don't set up website regularly.  I set up each of my servers once...years ago.  I haven't added a site since nor made any changes to wbat I have.  As such, this aspect of how all of this works is "new" to me.  (Plus, I'm exhausted from lack of sleep.)

At this point, I don't even know if I ever altered the default vhosts.  I lterally run the "rebuild_all" code I posted and nothing else to fix the problem.  I'm not making any other edits to the default files.

I'm at a loss as to how to permanently fix the problem.  I did try to follow the link you provided.  But, I must have missed a step.  (Seriously, though, thank you for trying to help us.) 

-----

Can anyone provide screenshots of what the WebServers Main Conf (and any other pages on CWP) is supposed to look like to fix this problem?  If I have an end-goal, I might be able to work backwards.

Or, maybe a more detailed tutorial.

I'm running Apache only, if that matters.

Title: Re: Conf files reset problem
Post by: Netino on January 03, 2022, 11:12:36 PM
(...)
Can anyone provide screenshots of what the WebServers Main Conf (and any other pages on CWP) is supposed to look like to fix this problem?  If I have an end-goal, I might be able to work backwards.

Or, maybe a more detailed tutorial.

I'm running Apache only, if that matters.

The menu "WebServers Settings", "WebServers Main Conf" serves to configure the configuration of all domains on your server.
The menu "WebServers Settings", "WebServers Domain Conf" serves to define the individual configuration of each domain.
Each one depends on how your site will work.
But it all depends on how your webserver is configured.
What is your configuration in "WebServers Settings", "Select WebServers"...?
Title: Re: Conf files reset problem
Post by: writerguyfl on January 04, 2022, 05:40:17 AM
Thanks for responding.

WebServer Settings --> Select WebServers:
Apache Only

(https://i.ibb.co/CvBzxZW/webserver-setting.jpg)

WebServer Settings --> WebServers Main Conf:
Apache default vhost template type: Default
Apache default vhost template: cloned_default*
Apache default vhost template: not installed
Apache default PHP-FPM template: cloned_all_methods*
PHP-FPM default template: cloned_default*

* These "cloned" files are copies of the templates from when the server is working properly.

(https://i.ibb.co/bFL8T8X/webserver-main-conf.jpg)

WebServer Settings --> WebServers Domain Conf --> username selected --> domain selected --> View/Edit Configuration

Configuration --> Web server Configuration dataserver11.com
Please Select: apache -> php-cgi

Apache Configuration
Apache default vhost template type: default
Apache default vhost template type: cloned_all_methods*

(https://i.ibb.co/RYnhKV4/webserver-domain-conf.jpg)

-----

Maybe what I did above will work.  I will report back if my sites get auto-suspended again at some point in the next 24 hours.
Title: Re: Conf files reset problem
Post by: tdn2kit on January 05, 2022, 06:30:42 AM
I got same problem. I didn't know why CWP do that. Why CWP run the cronjob reset to default? If CWP wanna we do not change it manual, oh please lock it! But if we can change that, please leave it alone! Don't do the nightmare at 3:50am, CWP change it back to default. WHY?
Title: Re: Conf files reset problem
Post by: mgworek on January 05, 2022, 04:59:08 PM
Thanks for responding.

WebServer Settings --> Select WebServers:
Apache Only

(https://i.ibb.co/CvBzxZW/webserver-setting.jpg)

WebServer Settings --> WebServers Main Conf:
Apache default vhost template type: Default
Apache default vhost template: cloned_default*
Apache default vhost template: not installed
Apache default PHP-FPM template: cloned_all_methods*
PHP-FPM default template: cloned_default*

* These "cloned" files are copies of the templates from when the server is working properly.

(https://i.ibb.co/bFL8T8X/webserver-main-conf.jpg)

WebServer Settings --> WebServers Domain Conf --> username selected --> domain selected --> View/Edit Configuration

Configuration --> Web server Configuration dataserver11.com
Please Select: apache -> php-cgi

Apache Configuration
Apache default vhost template type: default
Apache default vhost template type: cloned_all_methods*

(https://i.ibb.co/RYnhKV4/webserver-domain-conf.jpg)

-----

Maybe what I did above will work.  I will report back if my sites get auto-suspended again at some point in the next 24 hours.

Where you working this morning?
Title: Re: Conf files reset problem
Post by: writerguyfl on January 05, 2022, 07:43:40 PM

I don't know if anything has been resolved.  I've been manually changing the active hours in the etc/anacrontab file like kadybee mentioned because I hadn't had time to work on this project.

I think I'll have time to troubleshoot tonight.  If I do, I'll change the active hours and monitor my servers to see if the problem reoccurs.
Title: Re: Conf files reset problem
Post by: mgworek on January 05, 2022, 08:36:06 PM

I don't know if anything has been resolved.  I've been manually changing the active hours in the etc/anacrontab file like kadybee mentioned because I hadn't had time to work on this project.

I think I'll have time to troubleshoot tonight.  If I do, I'll change the active hours and monitor my servers to see if the problem reoccurs.

I changed my hours as well. One server went down in the last hour but I didn't do all the steps you did yet. I have another server that is fine all except for one host file that went it gets reset is goes down. Waiting for another server to go down any minute now.

What a freaking pain.
Title: Re: Conf files reset problem
Post by: mgworek on January 05, 2022, 09:25:36 PM
Ok, after getting the whole bandwidth problems figured out after like 3 days in, I think most of my servers were doing ok, I just didn't know it. We have 2 servers that go together with dns fail over and each one has it's own alias so we can directly test the server. The alias was failing every day on the host rewrite but the main site was working.

I had to go into CWP and create a subdomain which then created it it's own host file with the same certs and an apache rewrite worked and nothing went down.

It was working fine with us just adding the alias to the host file directly but we know what happens now with that......

I do have another server that I am still have issues with. It's has been working fine for the most part except for one domain because I had to manually edit the host file with the certs. CWP doesn't know the certs are there so when the host files get rewrote, all of them except for this one domain are working correctly. It's a cert from cloudflare that wouldn't install through cwp.
Title: Re: Conf files reset problem
Post by: studio4host on January 05, 2022, 10:05:13 PM
you need to check that your account is not exceeding bandwidth if you get suspended page.

1. make sure you have the latest cwp version
2. check account bandwidth limit (if suspended page)
3. use custom vhosts if you have custom changes in the apache/nginx vhost files


info from the cwp wiki
http://wiki.centos-webpanel.com/account-suspended
http://wiki.centos-webpanel.com/webservers-vhost-templates
Title: Re: Conf files reset problem
Post by: writerguyfl on January 08, 2022, 07:53:23 AM
Where you working this morning?

Ok, after getting the whole bandwidth problems figured out after like 3 days in, I think most of my servers were doing ok, I just didn't know it.

I've gone through two days without having my sites crippled by this asinine new CWP obstacle.  Since the programmers don't care enough about their clients to be transparent about what changes they made, it's tough to know if the fix was changing the templates or something they did behind the scenes.

Good luck in getting your cloudfare issue sorted out.