Working with Apache2 -VirtualHosts in Ubuntu

Working with Apache2 -VirtualHosts in Ubuntu.


Working with Apache2 -VirtualHosts in Ubuntu

Here my intention is very clear that I need a mylocal web saltstake documentation so when ever I want to read I can read that doesnt matter of internet connection.

By the way official PDF,epub documentation is available.

1. Chosen some hostname for example and same with www. add these names with IP you want with localhost in /etc/hosts file.

echo “” >> /etc/hosts
echo “” >> /etc/hosts

2 So next placed particular website content in /var/www/html/ folder and then changed permission to raja.

cd /var/www/html/
chown -R raja.raja SalkStaka/

and now checking

root@raja:/var/www/html# ls -ltrh
total 20K
-rw-r–r– 1 root root 12K Jan 12 20:35 index.html
drwxr-xr-x 9 raja raja 4.0K Jan 12 21:30 LPIH
drwxrwxr-x 3 raja raja 4.0K Mar 27 14:17 SaltStake

3.Now location set , site name set. We have to focus on remaining configuration of the website.
First lets focus on sites-available/ directory. Here we write configuration for available sites. so copy existing configuration and name it into our new site then we can do changes internally.

cp /etc/apache2/sites-available/ /etc/apache2/sites-available/

edit the file with

vim /etc/apache2/sites-available/

Then add/modify following lines accordingly

ServerAdmin raja@localhost
DocumentRoot /var/www/html/SaltStake
DirectoryIndex contents.html

Then save & Close.

4. So after we did this we have to enable to site , when we enabled automatically it will sync with sites-enabled directory.

To enable a site


then after that if you look into sites-enabled

root@raja:/etc/apache2# ls -ltrh /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 35 Jan 12 20:35 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 35 Jan 12 21:16 -> ../sites-available/
lrwxrwxrwx 1 root root 32 Jan 12 21:16 -> ../sites-available/
lrwxrwxrwx 1 root root 36 Jan 12 21:26 -> ../sites-available/
lrwxrwxrwx 1 root root 39 Mar 29 12:43 -> ../sites-available/

a link created between available-sites and enabled-sites.

then restart/reload apache2 with

service apache2 reload

That’s it.

It will work for VirtualHosting with IP and name

Restore Permission on Home directory

This Post I am taking from askubuntu , not answered by me but posting in my blog so that it can help others in future.

Note: This is the way like doing as undoing what you have done.

sudo chmod -x * -R
find . -type d

You will get an error like below 
find: 'xxxxx': Permission denied 

then do as
find . -type d -exec chmod +x {} \;

Fix conky hiding

I have installed and got some conky script but after system starting its hiding automatically and the only way I can see it while shutting down.

So I have googled and got some solution which can fix my problem.

Open your conkyrc file which is a hidden file  in home directory with

$ vim  .conkyrc


$ vim ~/.conkyrc

Find the area of below lines and make the configuration as I have mentioned.

own_window yes
own_window_class Conky
own_window_type normal
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager 
own_window_transparent yes

Then save and exit from your conkyrc file.

Then in we have to reload the conky with updated configuration , so all you have to do is kill the conky and then start it again.

so In your terminal as root user do as

# killall conky & conky


$ su -c ” killall conky & conky”

I hope that will help you.