[...] I've a VPS running on CPanel. Having attempted to configure WP-MU properly to use subdomains, I've discovered that you cannot edit
httpd.conf directly to add in your settings or your conf will break. Good thing is I managed to find a tutorial on how to properly edit
httpd.conf. Some of you may find this useful CPanel EasyApache and Customizing
httpd.conf | Jangro.com [...]
I've only had to edit my
httpd.conf once, well actually it wasn't me, it was for a client. It's not quite at the level you were at, but a nice little edit if the situation arises.
Basically my client needed to add some php script to his site: I was helping him solve the problem of Google returning his home page in their SERPs with a clickbank hoplink! The problem was, all his site was .html and we didn't want to rename his files to .php and lose the page rank.
The solution was to add this line to his
httpd.conf:
AddType application/x-
httpd-php .html
So that the server processed his .html files as if they were .php . Nice.
In a cPanel environment, you could also click on "Mime Types" and have the same effect by adding .html to the application/x-
httpd-php mime type. This will also curb the need for manual edits to
httpd.conf
Well, this almost works, however, when I do what is above, it creates includes for ALL sites on the server. Not a problem you say? Well, I have three sites on the server using wildcard domains, and now only the first one listed in the
httpd.conf works correctly - the others get 404 not found errors. Darn, I wish cpanel would provide a way within the thing to do wildcard subdomains - would really solve this for a lot of people. :(
As of version 11.23, you can add wildcard subdomains via the cPanel interface. Simply go through as if you were creating a regular subdomain. Just enter the * character (an asterisk) for the subdomain field and cPanel will handle the rest automatically. No manual
httpd.conf editing is necessary.
[...] Google is your friend here you go. CPanel EasyApache and Customizing
httpd.conf | Jangro.com [...]
This was implemented when we implemented EasyApache 3. You can find the current EasyApache documentation on our website at: http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html" target="_blank">
http://www.cpanel.net/support/docs/ea/ea3/customd...
Warning: I'm geeking out for a bit here with a technical entry about editing apache configuration files in Cpanel. I barely found anything out on the Interwebs about this, so I thought I'd document what I learned.
All of our web servers run the CPanel host management software. It's nice having so much of the server configuration options configurable with a web interface.
But sometimes, I need to make changes directly to the apache server configuration files (httpd.conf). This has never been a problem, as long as I didn't screw anything up of course. I just edit the configuration file, restart apache and move on with life.
That is, until recently. At some point, the CPanel software was updated so that it builds the httpd.conf file based on the information that it gathers from the CPanel configuration settingsf. Now, if you simply edit this file, CPanel WILL overwrite your changes at some later time, breaking whatever functionality you were specifying.
There are all sorts of warnings now in the httpd.conf file instructing that it is no longer appropriate to edit this file directly.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #Direct modifications to the Apache configuration file may be lost upon subsequent regeneration of the configuration file. To have modifications retained, all modifications must be checked into the configuration system by running:
/usr/local/cpanel/bin/apacheconfdistiller --update
To see if your changes will be conserved, regenerate the Apache configuration file by running:
#
/usr/local/cpanel/bin/buildapacheconf
and check the configuration file for your alterations. If your changes have been ignored, then they will need to be added directly to their respective template files.
This configuration file was built from the following templates:
/var/cpanel/templates/apache1/main.default
/var/cpanel/templates/apache1/main.local
/var/cpanel/templates/apache1/vhost.default
/var/cpanel/templates/apache1/vhost.local
/var/cpanel/templates/apache1/ssl_vhost.default
/var/cpanel/templates/apache1/ssl_vhost.local
Templates with the '.local' extension will be preferred over templates with the '.default' extension.
The only template updated by the apacheconfdistiller is main.default.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
I'm not sure exactly when this happened, though I think it was in the past few months. Or at least my hosting providers updated CPanel to this version recently.
You CAN edit the main httpd.conf settings as long as you run the apacheconfdistiller script to check in the changes.
You CANNOT edit the virtualHost settings and save them with that same script, however. They will not stick.
In order to make customizations to any VirtualHost sections of the httpd.conf file, you must create include files.
The documentation on this is quite poor, but here's what I figured out.
If you want to change the default VirtualHost settings, either globally, for a specific user, or for a specific domain, you must do so by overriding those settings with separate include file, placed in a very specific directory location. Once you create the appropriate include files in the correct directory tree, a script will add those include files to your httpd.conf file for you.
To me, I only ever want to edit the vhost behavior on a single domain, so I'll cut to the chase here and show that example:
First, create the following directory struture and file:
/usr/local/apache/conf/userdata/(ssl|std)/(1|2)/<user>/<domain>/custom.conffor Standard (non-ssl), apache version 1, user called abc, domain called abc.com it would look like this:
/usr/local/apache/conf/userdata/std/1/abc/abc.com/custom.confThen put your custom directives in that file. In my case, I wanted to handle wildcard subdomains, so I just added this one line:
ServerAlias *.abc.comNow, run the following script:
/scripts/ensurevhostincludes --user=joeAnd the appropriate include directives will get added to the VirtualHost sections of your httpd.conf file.
I ran the distiller, just to make sure the data was saved, though that may not be necessary.