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.

[root@dnsserver.dalaris.com] [/etc/bind/dalaris] # vi dalaris.com

Add this line:

mysite IN A 4.6.8.10

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.

root@webserver:/etc/apache2/sites-available#
cp samplesite.dalaris.com mysite.dalaris.com

Change contents of mysite.dalaris.com using vi:

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

 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.