Apache

From CPWiki

(Redirected from Guide-to: Apache)
Jump to: navigation, search

In this article, you can find lot of information about Apache 2 / cPanel 11+, mainly how to change things on httpd.conf on the right wya


[edit] Files/Scripts

/var/cpanel/userdata/USER/
store individual vhosts information
/usr/local/apache/conf/httpd.conf
main httpd.conf - do not edit it directly, as cPanel rebuilt it from templates
/usr/local/cpanel/bin/build_apache_conf
cPanel script to rebuild httpd.conf from templates
/usr/local/cpanel/bin/apache_conf_distiller --update
cPanel script that try to guess what you changed on last edit on httpd.conf, do not work in all the cases
/var/cpanel/templates/apache2/
directory of httpd.conf templates
/usr/local/apache/conf/includes/
directory of includes:
  • post_virtualhost_2.conf - included at end of virtualhosts
  • pre_main_2.conf - included at top of httpd.conf
  • pre_virtualhost_2.conf - included before virtualhosts
/usr/share/ssl/certs/
all certificates requests (*.csr) and public certificates files (*.crt)
/usr/share/ssl/private
all certificates private keys (*.key)

[edit] Creating Apache userdata skel

Sometimes when upgrading Apache cPanel doesn't create userdata directories, nether users directories inside userdata. So, run these commands (they won't remove any data)

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

To create a user specific directory to store it configuration, for example, on std (http) and apache 2:

mkdir /usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN -p

Where USERNAME is domain unix user and domain is it domain.

Store your virtualhost configuration inside /usr/local/apache/conf/userdata/std/2/USERNAME/DOMAIN/foo.conf

Where foo.conf is something you can remember, as svn.conf

After that:

/usr/local/cpanel/bin/build_apache_conf

[edit] Uninstalling a SSL

Easy way:: Just call:

/scripts/killsslvhost DOMAIN

Hard way:

  • move /var/cpanel/userdata/USER/*_SSL to a safe place
mkdir /root/oldssl
mv /var/cpanel/userdata/USER/*_SSL /root/oldssl
  • run build_apache_conf:
/usr/local/cpanel/bin/build_apache_conf
  • restart httpd:
service httpd restart
Personal tools