Web Hosting Resource Kit

Web Hosting, Web Hosting Reviews & Virtualization

Apache HTTP Web server configuration Tutorial

July 11, 2006 By Christoph Puetz Leave a Comment

  • Tweet
  • SumoMe
  • Tweet

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
      (Suse: /var/log/apache2/)

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.

Related posts:

  1. Apache Webserver – A quick tutorial for new Admins
  2. Upgrade To APACHE 2.0 Web Server
  3. How to remove or disable mod_evasive from Apache Web Server?
  4. What is Mod_Security (on cPanel server)?
  5. How to rotate your Apache Log Files?
  6. Restoring Domain Accounts and Server Config Files with WHM / cPanel
  7. Linux Tutorial: How to change the IP ADDRESS on a Linux machine

Filed Under: Web Hosting

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Business Management
  • Editors Column
  • Hosting Customers
  • Interviews & PR
  • Marketing/Advertising
  • Online Marketing/SEO
  • VMWare
  • Web Host Startup
  • Web Hosting
  • Web Hosting Reviews

Pages

  • About Us
  • Contact
  • Disclosure Policy
  • Sitemap
  • Terms of Service
  • Welcome to Web Hosting Resource Kit

More Web Hosting

  • Top 10 Web Hosts

Copyright Webhostingresourcekit.com© 2018 · Log in