How to setup an Apache web server on Linux

The Apache HTTP Server is an open-source HTTP server for Linux operating systems such as RedHat, CentOS and Fedora.

For more information on Apache HTTP Server, you can visit their website athttpd.apache.org.

This documentation was written for Apache HTTP Server running on CentOS version 6.5.


1. Install the Apache HTTP Server. To install it, type the following as the “root” user via command line:

yum install httpd

Please note that this is typically installed with CentOS by default.

2. Set the apache service to start on boot. To configure this, type the following as the “root” user via command line:

chkconfig –levels 235 httpd on

3. Enable “name-based virtual hosting on port 80”. You will need to edit the “httpd.conf” file located in the “/etc/httpd/conf” directory.

Un-comment the line containing the text:

NameVirtualHost *:80

And then save the file.

4. Configure “SELinux” to be set to “permissive” or “diabled”. Otherwise, you will trigger the following error message in your browser when trying to access a webSurvey or webCATI survey

“tcp_listen(0) – listen failed: (13) – Permission denied into checkcore(), c->core is NULL! Good luck.”

This error message is triggered when the Linux configuration for the SELINUX setting “/etc/selinux/config” file by default is set to “enforcing” insteadof “permissive” or “disabled”. In order for the Survox software to function, we require the hosted system to have either “permissive” or “disabled” setfor the SELINUX setting and especially for the “websrv8#.cgi” as it needs access to ports above 1024 where SELINUX disables access to those ports.

Below is an example of how this should be configured as the root user on a machine. Also note that “SELINUXTYPE” should be set to “targeted”. Another way to debug this is to rerun the ./wssetup as part of the installation process, there you would have seen a note mentioning what the current SELINUXand SELINUXTYPE settings were set to.

/etc/selinux % more config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#       enforcing - SELinux security policy is enforced.#       permissive - SELinux prints warnings instead of enforcing.#       disabled - SELinux is fully disabled.SELINUX=disabled# SELINUXTYPE= type of policy in use. Possible values are:#       targeted - Only targeted network daemons are protected.#       strict - Full SELinux protection.SELINUXTYPE=targeted# SETLOCALDEFS= Check local definition changesSETLOCALDEFS=0

Note: Another way to quickly configure SELinux is to type via command line “setenfoce permissive” or “setenforce disabled”.

5. Restart the Apache HTTP Server daemon. To restart the the Apache HTTP Server daemon, type the following via command line as the “root” user:

service httpd restart

Note: You may trigger the following warning message “NameVirtualHost *:80 has no VirtualHosts”, but you can ignore that warning message for now.

6. Test that the Apache web server is running. Simply point to your localhost, IP address or domain name of the server in your web browser and you should be presented an Apache test page.