After create an new account the apache settings are reset

DevBreak

Active Member
Jun 26, 2006
32
0
156
Hello,
Another bug in whm destroy my live.
I have custom settings in apache httpd.conf (maxclients, keepalive , etc..) after i create an new account in whm this settings are gone and replaced with default. In this case the default settings are not good for me.

What can i do?

Apache 1.3.39 EA3
RHE4 & FedoraCore 5 - same problem .

Waiting for an urgently solution...
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
Make your changes to httpd.conf, then run /usr/local/cpanel/bin/apache_conf_distiller --update --main

it should preserve your settings then.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
In brief, we have consolidated all management of httpd.conf into a "cPanel" database, found in /var/cpanel/useradata apache_conf_distiller is used to create and maintain that data. httpd.conf is rebuilt based upon that data. We don't recommend modifying the data in /var/cpanel/userdata
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
So a new protocal would be to run /var/cpanel/useradata apache_conf_distiller whenever any manual edit is done to httpd.conf?
You need to run it with --update --main, otherwise it won't do anything.

Otherwise, correct. After making changes to the global values, run:

Code:
/usr/local/cpanel/bin/apache_conf_distiller --update --main
to preserve the changes.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
No, changes to VirtualHost will not be preserved. Those changes need added to /usr/local/apache/conf/userdata/std/<apache version>/<user name>/custom.conf

The file doesn't actually need to be named customer,conf, as long as it end with .conf

After adding such a file, run:
Code:
perl /scripts/ensure_vhost_includes
once that is done, the Include directives will be added to the vhost and retained across httpd.conf regenerattions.

On a side note, there is a bug in 17046 (Current and Edge) that causes the httpd.conf be regenerated by anything that modifies the httpd.conf. Thus, adding a subdomain will cause the entire file be regenerated. This will be fixed in the next build.
 

thedavid

Well-Known Member
Nov 22, 2002
124
0
166
No, changes to VirtualHost will not be preserved. Those changes need added to /usr/local/apache/conf/userdata/std/<apache version>/<user name>/custom.conf

The file doesn't actually need to be named customer,conf, as long as it end with .conf

After adding such a file, run:
Code:
perl /scripts/ensure_vhost_includes
once that is done, the Include directives will be added to the vhost and retained across httpd.conf regenerattions.

On a side note, there is a bug in 17046 (Current and Edge) that causes the httpd.conf be regenerated by anything that modifies the httpd.conf. Thus, adding a subdomain will cause the entire file be regenerated. This will be fixed in the next build.

This would've been good as part of documentation, or maybe included in the changelog or something. This is the first I've seen of it, and this was after doing some searching.

Also, how would this work if I wanted to say, change the secure web path for a domain? Rather than serving the pages from /home/username/public_html/ the client would like it served from /home/username/secure_html/

In what way is this possible?
 
Last edited:

Rafaelfpviana

Well-Known Member
Mar 12, 2004
141
0
166
Brazil
kenneth, i didn't find /usr/local/apache/conf/userdata/std/<apache version>/<user name>/custom.conf, in fact /usr/local/apache/conf/userdata doesn't exist for me.

By the way, would this be the correct way:

Code:
perl /scripts/ensure_vhost_includes  --all-users
 

mtech-hosting

Well-Known Member
Apr 30, 2006
62
0
156
Is this distiller something that cpanel came up with or is it new to apache? This seems like an aweful lot of work just to make a few changes here and there and i can see it leading to a whole slew of problems
 
C

cPanelBilly

Guest
Is this distiller something that cpanel came up with or is it new to apache? This seems like an aweful lot of work just to make a few changes here and there and i can see it leading to a whole slew of problems
This is a cPanel thing and it is needed because of the multiple apache versions
 

JamieD

Well-Known Member
Sep 3, 2003
58
0
156
No, changes to VirtualHost will not be preserved. Those changes need added to /usr/local/apache/conf/userdata/std/<apache version>/<user name>/custom.conf
The userdata directory does not exist on my system, if this is manually created will cPanel pick it up, for instance if I created:

/usr/local/apache/conf/userdata/std/1.3/a_user/custom.conf

then ran perl /scripts/ensure_vhost_includes
 

Koreru

Member
Nov 17, 2006
18
0
151
OK. This is a problem directly related to the topic:

I've got something close to the following line on a few accounts:
Code:
CustomLog "| /home/username/public_html/cgi-bin/filename.cgi" "%a|%u|%s|%{SOMEOTHERNAME_HASH}e|%b|%{SOMEOTHERNAME_WORK}e|%{SOMEOTHERNAME_BLOCKED}e"

It was working until we updated recently. (Now running 11.12.0-C17073 w/Apache 2.2)

If I edit httpd.conf, /usr/local/cpanel/bin/apache_conf_distiller doesn't parse the line correctly. It removes the quotes and pipe for the first part and then places the whole line in the "format" part of /var/cpanel/userdata/username/domainname, and the "target" part is set to "/".

If I edit /var/cpanel/userdata/username/domainname directly, it doesn't add anything to httpd.conf when I run /usr/local/cpanel/bin/build_apache_conf.

Any ideas?

Edit----------------------------------------------------------------------------------------------------------------------------------


OK, I found the answer here: http://bugzilla.cpanel.net/show_bug.cgi?id=5893

2. A httpd.conf 'fragment' file stored in /usr/local/apache/conf/userdata

With option #2, if that directory doesn't exist, then create the following
hierarchy:

mkdir /usr/local/apache/conf/userdata
mkdir /usr/local/apache/conf/userdata/std
mkdir /usr/local/apache/conf/userdata/ssl
mkdir /usr/local/apache/conf/userdata/std/1
mkdir /usr/local/apache/conf/userdata/std/2
mkdir /usr/local/apache/conf/userdata/ssl/1
mkdir //usr/local/apache/conf/userdata/ssl/2

Then in the appropriate subdirectory, create a directory for the user name.
Place the configuration fragment file in that directory (e.g.
/usr/local/apache/conf/userdata/std/2/username/fragment.conf). Make certain the
file has the .conf extension. Finally run /scripts/ensure_vhost_includes (might
need to execute as: perl /scripts/ensure_vhost_includes), which will add the
particulars to httpd.conf. After this is done, the customizations become part
of the system and are retained.


This should answer your question as well, JamieD.

The userdata directory does not exist on my system, if this is manually created will cPanel pick it up, for instance if I created:

/usr/local/apache/conf/userdata/std/1.3/a_user/custom.conf

then ran perl /scripts/ensure_vhost_includes
 
Last edited:

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
OK. This is a problem directly related to the topic:

I've got something close to the following line on a few accounts:
Code:
CustomLog "| /home/username/public_html/cgi-bin/filename.cgi" "%a|%u|%s|%{SOMEOTHERNAME_HASH}e|%b|%{SOMEOTHERNAME_WORK}e|%{SOMEOTHERNAME_BLOCKED}e"

It was working until we updated recently. (Now running 11.12.0-C17073 w/Apache 2.2)

If I edit httpd.conf, /usr/local/cpanel/bin/apache_conf_distiller doesn't parse the line correctly. It removes the quotes and pipe for the first part and then places the whole line in the "format" part of /var/cpanel/userdata/username/domainname, and the "target" part is set to "/".
apache_conf_distiller shouldn't be choking on that. Sounds like a parsing bug.
 

Koreru

Member
Nov 17, 2006
18
0
151
apache_conf_distiller shouldn't be choking on that. Sounds like a parsing bug.
Yeah, I don't think it likes the quotation marks (Or the space after the pipe, maybe?).

It's a moot point though since that doesn't seem to be the proper way to do it anyways. Adding the fragment files to /usr/local/apache/conf/userdata works good. Now that we've figured it out, I actually think it's a pretty decent setup. But it'd be nice to have a WHM interface for it with the directories created automatically.
 
Last edited:

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
80
458
cPanel Access Level
Root Administrator
OK, this is a quickie on using the /usr/local/apache/conf/userdata /magic/

1. If the directory does not exist, create it:
Code:
shell> mkdir /usr/local/apache/conf/userdata
2. The directory hierarchy is as follows:

Code:
shell> cd /usr/local/apache/conf/userdata
First level of directories are std and ssl std means non-SSL settings and ssl means SSL settings. Within both of those directories you would create two directories 1 and 2. These correspond to the Major Apache versions. Thus, one would not create 1.3, 2.2 or 2.0

Within the directories that correspond to the Major Apache version, would be directories for each cPanel user name. Within those directories for each user name would be directories for each domain owned by the account. Thus, if my user name is cpkenneth and I own the domain cpanelkenneth.info and my cPanel server runs Apache 2.2 and I wanted fine-grained control over the vhost that configures that domain, I would drop a conf file in:

Code:
shell> mkdir -p /usr/local/apache/conf/userdata/std/2/cpkenneth/cpanelkenneth.info
shell> cd /usr/local/apache/conf/userdata/std/2/cpkenneth/cpanelkenneth.info
shell> vim custom.conf
shell> /scripts/ensure_vhost_includes --user=cpkenneth
shell> /scripts/restartsrv_httpd
Whereas, if I wanted to customize behavior for all vhosts on that hypothetical server, I would do this:

Code:
shell> mkdir -p /usr/local/apache/conf/userdata/std/2/
shell> cd /usr/local/apache/conf/userdata/std/2/
shell> vim custom.conf
shell> /scripts/ensure_vhost_includes --all-users
shell> /scripts/restartsrv_httpd
The file does not need named custom.conf, as long as it ends in .conf

We are working to simplify some of this, based upon user request.

Since this is a "quickie" there are likely errors/typos.