azanmi
By:
azanmi

Setup apache error

April 18, 2014 2.3k views
I have just followed the instructions in this link: https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6 But my apache won't start, any idea why? Thank you.
11 Answers
Look at Apache's logs. Not sure where they are on Centos, probably in /var/log somewhere. There should be information on what's going on there.
The apache has now started but I am seeing Apache2 Test Page, Not the index.html that I have created in the link above. What could be the issue here?
Where do you have your index.html file placed?
@colin I have placed in /var/www/domain.com/public_html/ just like as instructed in this link:

https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-centos-6

by Etel Sverdlov
This tutorial shows you how to set up a new directory, how to grant the correct permissions, how to add content to a new page, how to turn on virtual hosting, and how to, if needed, set up local hosts. Virtual Hosts are used to run more than one domain off of a single IP address and allows you to run multiple sites off of a single DigitalOcean droplet. This tutorial describes how to set up virtual hosts with Apache on Centos
Will you paste the contents of the vhosts section of your apache httpd.conf file.

What was the error thrown when apache didn't start? That may be a hint of something in your httpd.conf not properly set. How did you fix it to get apache to start?
Here is the vhosts section of the file:

NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

ServerAdmin webmaster@cendivo.com
DocumentRoot /var/www/cendivo.com
ServerName www.cendivo.com
ServerAlias cendivo.com
ErrorLog /var/www/cendivo.com/error.log
CustomLog /var/www/cendivo.com/requests.log common



The error is just with the url. Not big of a deal. Just missed it. Thank you for your help.
Make sure to surround your virtual host directives with


....



"The error is just with the url. Not big of a deal. Just missed it. Thank you for your help."

Do you have it working?
It looks like digital ocean is escaping what it thinks is html (please excuse the added spaces)

Surround your directives with

< VirtualHost *:80 >

< / VirtualHost *:80 >
It is correct, i am not really sure why the text is removed. The apache has started successfully.

< VirtualHost *:80 >
ServerAdmin webmaster@cendivo.com
DocumentRoot /var/www/cendivo.com
ServerName www.cendivo.com
ServerAlias cendivo.com
ErrorLog /var/www/cendivo.com/error.log
CustomLog /var/www/cendivo.com/requests.log common
< /VirtualHost >
Have another answer? Share your knowledge.