Skip to main content

How To Setting up Apache Virtual Hosts in Ubuntu 14.04

Setting up Apache Virtual Hosts in Ubuntu 14.04 is a little complicated. First, you have to make directory for you web. 

mkdir /home/UserA/htdocs

sudo chown -R UserA:UserA /home/UserA/htdocs

sudo chmod -R 755 /home/UserA/htdocs

Next we'll create a test page for our virtual host.

echo 'Test Site' > /home/UserA/htdocs/index.html

Now we are going to start with a sane configuration for our new virtual host.

cd /etc/apache2/sites-available

sudo cp 000-default.conf 001-UserA.conf

We need to edit our base configuration for our purposes.

sudo nano 001-UserA.conf

In the file that opens change the ServerAdmin to your own email address DocumentRoot to our document root and add ServerName and set that to the name of the website

ServerAdmin admin@UserA.com

DocumentRoot /home/UserA/htdocs

ServerName UserA

We also want to set the different log files for our hosts so change the ErrorLog and CustomLog to read something like this:

ErrorLog ${APACHE_LOG_DIR}/UserA.error.log
CustomLog ${APACHE_LOG_DIR}/UserA.access.log combined

Lastly we want give Apache permission to access our folder. If you forget to add these lines you will receive a 403 Forbidden error when you try to access your website. Add these lines right after the log configurations:

<Directory /home/UserA/htdocs
Require all granted
</Directory>

Save and exit the file (Ctrl+X). Now in enable the virtual host

sudo a2ensite 001-UserA.conf

Check if there are any errors in the newly added configuration files

apachectl configtest

If you see a Syntax OK message then we have configured Apache correctly and are ready to reload the configuration

sudo service apache2 reload

Optionally you may want to edit your /etc/hosts file and add the new hostname there

sudo nano /etc/hosts

Add the following lines at the bottom of the file

127.0.0.1 UserA.com

 Now open your a browser and visit your virtual host site .


Popular posts from this blog

Free Stuff

I have free stuff that can i share with you. The free stuff is free magazine, free domain, free hosting, free rapidshare link generator and free money. 1. Free Magazine. You can get free magazine for you to read. There are many topics that can you choose. These are the topics that can you choose : Agri c ulture Automotive Biotechnology & Pharmaceuticals Computers Construction Education Engineering Executive & Management Finance Food & Beverage Government Healthcare Human Re sources Industrial & Manufacturing Internet Information Technology IT - Data Management IT - Security IT - Software & Development IT - Storage Insurance Mechanical / Machine Meetings & Travel Multimedia Network / Communications Purchasing & Procurement Retail Sales & Marketing Small & Medium Business Telecom & Wireless Trade/Professional Services Transportation & Logistics Utility & Energy Many topics...

Centos 5 Live CD, Rescue CD or Workstation

Have you ever try CENTos 5 Live CD? I had tried it. This Centos 5 Live Cd can be use as rescue cd and workstation cause it based on CentOS 5.0 i386 distribution. The following software that include with it : OpenOffice.org 2.0.4 Firefox 1.5.0.10 Thunderbird 1.5.0.10 Gaim-2.0.0 Scribus-1.3.3 xchat-2.6.6 k3b-0.12.17 Gimp-2.2.13 And for rescue, there is another software or tool : Full set of LVM and RAID command line tools QTParted Nmap and NMapFE Graphical Traceroute samba-3.0.23c with cifs kernel support to connect to Windows file shares System Log Viewer GUI Hardware Device Manager Unfortunately, in first release, this Centos Live CD doesn't hvae installer like Fedora Live CD.  And i have a problem when using it as workstation, i can connected to network just for a while. But, when i restart network service it worked but for a while and then it was drop. You have a same problem or solution ? Please tell me.  I will be appreciated it. Last, if you want to use root account, use thi...

Rapidshare Premium Link Generator

Rapidshare Premium LINK Generator . Rapidshare.com is one of the biggest site that allow you to upload and share files with vary sizes. From rapidshare, you also can download files that another person upload the re. There are 2 kinds of user can download from rapidshare. First, free user, this user have limit features from rapidshare. Limit bandwidth, limit connection, etc. Second, premium user. Premium user have many features that free user doesn't have. If you want to be a premium user, you have to buy it from the web. You can use this link to buy premium account or from reseller that near you. But if you have not enough money to buy it, you can use Rapidshare Premium Link Generator . This is a website that give free service for anyone to generate rapidshare link from free to premium, so anyone can download with premium feature. &amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;br&amp;amp;amp;amp;amp;amp;amp;gt;I...