As you can see, the address 127.0.0.1 (or whatever address you see there, usually your main IP address) is used as the server name by default. It's a good idea to set the ServerName for the next time the server is started.

Open the main Apache “config”:

sudo nano /etc/httpd/conf/httpd.conf

Towards the end of the file you'll find a section that starts with ServerName and gives the example:

#ServerName www.example.com:80

All you need to do is enter your Cloud Server host name or a fully-qualified domain name:

ServerName demo

Note that my Cloud Server host name is “demo”.

Now just reload Apache:

sudo /usr/sbin/apachectl restart

And the warning has gone.

Firewall

Notice that in some versions of CentOS, a firewall is installed by default which will block access to port 80, on which Apache runs. The following command will open this port:

sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT

Remember to save your firewall rules after adding that instruction so your web server will be accessible the next time you reboot:

sudo service iptables save

For more information on firewalls and their configuration, it is strongly recommended to read the Firewalls section of our knowledge base.

Default Page

If you navigate to your Cloud Server IP address:

http://123.45.67.89

You will see the default CentOS Apache welcome screen:

This means the Apache install is a success.

Chkconfig

Now that we have Apache installed and working properly, we need to make sure that it's set to start automatically when the Cloud Server is rebooted.