In my previous article I have explained how to install Apache Web Server in Linux.
In this article I will guide how to configure your Apache web server after installation.
Configure Apache HTTPD Sever
About HTTPD Conf File:
The httpd.conf is the primary configuration file in Apache Web Server in RHEL and CentOS. It is located at /etc/httpd/conf folder. It is a text file and consist of directives, containers and comments.
Directives Example in httpd.conf file
ServerRoot Listen Include AllowOverride
Containers Example
Containers enclose one or more directives.
<Directory /> AllowOverride none Require all denied </Directory>
Comments Example
# Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the # directive.
Configure Apache httpd.conf File
There are a few Apache configuration need to alter before you can start running the Apache web server. All the main configuration file is in httpd.conf file.
# vi /etc/httpd/conf/httpd.conf
Edit below directives and matches the value to your web server environment
ServerAdmin admin@your-domain.com
This is where your problem with the server should be e-mailed. This address appears on some server-generated pages, such as error documents.
DocumentRoot /var/www/html
The top level directory for Apache server content. The apache user requires read access to any files and read and execute access to the directory and any of its sub-directories. Do not place a slash at the end of the directory path.
ServerName www.ehowstuff.local:80
Specifies the fully qualified domain name or IP address of the httpd server and an optional port on which the server listens. The FQDN must be resolvable to an IP address.
If you do not specify a FQDN, the server performs a reverse-name lookup on the IP address. If you do not specify a port, the server uses the port corresponding to the incoming request.
AllowOverride All
In Apache 2.4, AllowOverride is set to None by default. When AllowOverride is set to None , then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.
When AllowOverride directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files.
htaccess is short for Hypertext Access, is a configuration file for use on web servers running the Apache Web Server software. Most of the developers today use htaccess to configure the details of the blog or website without needed to alter the server config files.
Restart or reload the Apache web service to apply the new configuration.
# systemctl restart httpd OR # systemctl reload httpd
Now access your web server using IP Address:
If you want to run multiple website you can configure Apache Virtual Host. Follow below link to configure Apache Virtual Host.
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
Leave a Comment