This may be applicable to all Apache 2 versions.
Apache is installed with CentOS 5 by default.
To check if the Apache Server is installed
Or (with yum, you need to be on line)
If not installed, then install it with:
To install the text-based browser:
To use elinks:
To access Apache Server on CentOS 5:
Open a browser and enter:
You do not need to do any thing to the default configuration httpd.conf file to get your Apache Server running.
All you need is to write your index.html and your web pages and place them in /var/www/html.
The default DocumentRoot is located in /var/www/html.
The default home page is located in /usr/share/doc/HTML/index.html.
The default ServerRoot in httpd.conf is ServerRoot “/etc/httpd”.
Make sure the firewall does not block access to port 80 by running:
Configure Apache service to start when the system is rebooted.
Configure Apache Server to restart on CentOS 5
To allow only authorized users who have passwords, add the following lines to /etc/httpd/conf/httpd.conf.
Just before the commented option for the UserDir directive:
AuthType Basic AuthName "Test Passwords" AuthUserFile /etc/httpd/passdb Require user user1
Test the syntax with one of the followings:
Restart Apache
To create the passwords database passdb in /etc/httpd and add user1 to it run the following command:
To add another user, run the following command without the -c switch(which creates the database):
Add the following to the Directory if you want to allow access only to your network. If your network for example is 192.168.1.0:
Backup the httpd.conf configuration file.
Make sure Apache is running:
If not running, start apache with one of the followings:
Make sure Apache is running during the boot process with this command:
Test the syntax with one of the followings:
To view error log file run the following command:
To view Access log file run:
To restar Apache with out disconnecting the users run :
If you want stop Apache: