Apache Virtual Host Configuration


Arrrrrgggggghhhhh!!!!!!!

Linux and Apache great and frustrating all at the same time, how can this be !!!!!!!

Configuring an Apache server to run multiple web sites, nothing hard in that I hear you say.

For those who need a quick lesson, find the httpd.conf file and add lines of code at the end to mirror something like this.

httpd.conf is usually foounf in /etc/httpd/conf or /usr/local/apache2/conf depending on how it was installed.

To host multiple site you use the virtualhost parameters. So a simple site config is to host http://www.acmetest.com on the local server

<VirtualHost *:80>
ServerName www.acmetest.com
DocumentRoot /usr/local/apache2/htdocs/acme
<Directory “/usr/local/apache2/htdocs/acme”>
Options -Indexes +FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

So you would think this would work, but the default web server was still serving out the index.html page. After 1 hour of trying to work out what is wrong with these few lines I remembered in the back of my addled brain SElinux.

At a command line

setenforce 0

Restart the web server and hey it WORKS!!!!

This is not advisable for production systems. There is more regarding how to allow Apache configuration and SELinux on the Centos Wiki. Navigate to Section 5.

I will be looking at further on a little later and let you know what the commands are to get a working site with SELinux enabled.

 

Advertisements

One Comment on “Apache Virtual Host Configuration”

  1. […] Now that we have a working web server etc.. we need to lock the server down to a degreee. This is done with the creation of virtualhost in the httpd.conf file. More about how to configure VirtualHosts […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s