Archives for July 2006
• Private Network – Cross Connects
• IDS / IPS / DDOS Protection
• Windows / Redhat / CentOS / BSD
• cPanel & Plesk Control Panels
• Remote Reboot and Console
• PPTP & SSL VPN Gateways
• Internap / Savvis / Verio / Abovenet
Toll Free: 1-866-398-7638
ServerMatrix / ThePlanet Support – Two Thumbs Up
Quick Apache HTTP Web Server Configuration Tutorial
This Linux tutorial is for the Apache HTTP web server (Version 1.3 and 2.0). Web pages are served from the directory as configured by the DocumentRoot directive. The default directory location is:
* Red Hat 7.x-9, Fedora Core: /var/www/html/
* Red Hat 6.x and older: /home/httpd/html/
* Suse 9.x: /srv/www/htdocs/
The default home page for the default configuration is index.html. Note the pages should not be owned by user apache as this is the process owner of the httpd web server daemon. If the web server process is comprimised, it should not be allowed to alter the files. The files should of course be readable by user apache.
Apache may be configured to run as a host for one web site in this fashion or it may be configured to serve for multiple domains. Serving for multiple domains may be achieved in two ways:
* Virtual hosts: One IP address but multiple domains – "Name based" virtual hosting.
* Multiple IP based virtual hosts: One IP address for each domain – "IP based" virtual hosting.
The default configuration will allow one to have multiple user accounts under one domain by using a reference to the user account: http://www.domain.com/~user1/. If no domain is registered or configured, the IP address may also be used: http://XXX.XXX.XXX.XXX/~user1/.
The user directory generated by default using the useradd user1 command will set protections too tight for use with Apache. You must use: chmod 711 /home/user1. The default for directory creation is correct by default but if not use: chmod 755 /home/user1/public_html
When creating new "Directory" configuration directives, I found that placing them by the existing "Directory" directives to be a bad idea. It would not use the .htaccess file. This was because the statement defining the use of the .htaccess file was after the "Directory" statement. Previously in RH 6.x the files were separated and the order was defined a little different. I now place new "Directory" statements near the end of the file just before the "VirtualHost" statements.
For users of Red Hat 7.1, the GUI configuration tool apacheconf was introduced for the crowd who like to use pretty point and click tools.
Files used by Apache:
* /etc/rc.d/init.d/httpd – Start/stop/restart script
(Note: Debian uses the directory: /etc/init.d/httpd)
* /etc/httpd/conf/httpd.conf – Configuration file
* /var/log/httpd/access_log and error_log – Red Hat/Fedora Core Apache log files
Start/Stop/Restart scripts: The script is to be run with the qualifiers start, stop, restart or status.
i.e. /etc/rc.d/init.d/httpd restart. A restart allows the web server to start again and read the configuration files to pick up any changes. To have this script invoked upon system boot issue the command chkconfig –add httpd. See Init Process Tutorial for a more complete discussion.
Also Apache control tool: /usr/sbin/apachectl start
Apache Configuration File: The file /etc/httpd/conf/httpd.conf is used to configure Apache. In the past it was broken down into three files. These may now be all concatenated into one file. See Apache online documentation for the full manual.