Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Wednesday, February 24, 2010

How link another folder to your www web folder.

In last post I have describe the way to link your public_html folder to the www folder. To I will describe a simple way to link a folder to your /var/www to make easy your web developing stuff on linux.
1.To do that first you have to make a folder in your favorite place using mkdir command.
mkdir /home/abc/myFolder

2.Then go to your /var/www/ folder.
cd /var/www

3.Then link your folder to the www folder using ln command.
sudo ln -s /home/abc/myFolder

This will make an linking file in the www folder and you can see it in your www folder in the same name as you used for your linked folder

Now you can use your myFolder folder for run files in the web server by the address
/http://localhost/myFolder/

So use this method to make easy of your life in using servers for advance developments.

What is public HTML

If you are working with any kind of web server on linux operating system you might have suffered enough from the warning massages saying “This is write disabled file, please make the file write enable”, “Cannot move the file in to www folder” so on. So is it a headache for you. Here is an great and simple solution for your problem.


In linux most of the situations you have to copy your files such as html and php, in to the /var/www/ folder to run them on your favorite web servers such as apache web server. But this folder is protected and you need some permission to copy, remove or change files in the www folder. So when we are involve in a web development using large number of files moving here and there it is difficult to work in this kind of environment.


So now you can use another folder that is away from www folder which is not a protected one as your www folder. It will help you to make changes in the folder as you wish and you can get the same functions as in the /var/www folder. Following are the steps of making a public_html folder and make it enable for access by your user-name as http://localhost/~ABC.

  1. make a folder in your favorite place in your folder structure. But make sure it is not a protected folder. As an example make a folder in the user folder by using the following command in command prompt:

sudo mkdir /home/ABC/public_html/


  1. Go to the folder of your web server. As an example if you are using apache2 web server you can use following command

cd /etc/apache2/


  1. Then link your public_html folder to the web server.

sudo cp -r mods-available/userdir.* mods-enabled/


  1. Then restart your web server

sudo /etc/init.d/apache2 restart


Now you are ready to use your public_html folder as your web servers working folder.

You can access the folder by typing the following address on the address bar.

http://localhost/~ABC

The most important thing is if you are using your computer connected to a network and if others are access to your computer via network you can use this folder as the access folder to the out side, so the others can access to that folder with out permission enabled as well as you can keep your protected data away from this folder so others can't access those. Other wise if you enabled permission in the www folder the others may access to some other important data in your computer. The others can access to this folder by the address of your Internet address. As an example

http://www.your_net_address.com/~ABC


So please try this and feel the difference.