How to Enable a new Web Site on a Linux Apache Web Server

How to enable a new web site on a Linux Web Server

First, we need to make sure that there exists a DNS entry for the web site. Create the necessary DNS entry on the name server.

This step is straight forward if you use GoDaddy or Netfirms. If you use your own Linux server for DNS, here is the step by step instruction on how to add a new record in your DNS server.

[] [/etc/bind/dalaris] # vi

Add this line:

mysite IN A

Restart and flush DNS:

invoke-rc.d bind9 reload
rndc reload
rndc flush

At this time you can wait for DNS replication to take place on the Internet. If you are in a rush and can’t wait for DNS to take the changes, consider adding a host record in your host file.

Now copy the web site content to the web server (/home/www/web-folder)

SSH to the webserver.


Change contents of using vi:

 root@webserver:/etc/apache2/sites-available# vi
<VirtualHost *:80>
DocumentRoot /home/www/
ServerAdmin webmaster@localhost
<Directory /home/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order allow,deny
allow from all
ErrorLog ${APACHE_LOG_DIR}/ mysite.dalaris.com_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ mysite.dalaris.com_access.log combined

 Do the same as what we did for sites-enabled.

Now restart Apache and test.

service apache2 restart

On a client computer, you can test web site access.