2

I am a php programmer and new in ubuntu. Now I am using ubuntu 12.4 I need to create public html directory on my home directory for easy assess of php files. How can I create this public_html directory on my home folder. And how it configure as a apache server for run php scripts?

Bizzon
  • 123
  • 1
  • 1
  • 6
  • Hi and welcome to Ask Ubuntu! There is a more generalized post here. Please take a look there and let us know if that post address your issue. – Lucio Dec 10 '13 at 22:11

3 Answers3

6

Apache comes with userdir module which lets you use /home/USER/public_html as root directory.

You will access this public_html as localhost/~USER/

You may need to enable userdir, if not enabled, which is done by:

sudo a2enmod

By default Apache uses /var/www as document root.

Or you can create a virtualhost with your specific document root as well.

https://help.ubuntu.com/lts/serverguide/httpd.html

sagarchalise
  • 23,988
2

What I did for my case is created public_html directory in my home directory and then created symlink in /var/www to point to this public_html directory (creating a symlink).

In order to create a symlink you have to use the following command:

sudo ln -s /home/$USER/public_html /var/www

here $USER is your username. For more details check the site mentioned above.

Avinash Raj
  • 78,556
0

Thanks to all. Now I find correct way for configure apache from stack overflow. https://stackoverflow.com/questions/526742/how-can-i-make-a-public-html-folder-in-ubuntu

And from ask ubuntu

Should I symlink my /var/www directory to my home?

Bizzon
  • 123
  • 1
  • 1
  • 6
  • Please mark your question as solved by picking one of the available answers. – Huckle Dec 11 '13 at 04:44
  • I can't mark it as today. Stackoverflow says that "You can accept your own answer tomorrow". Then How can I? – Bizzon Dec 11 '13 at 05:09
  • Anti-cheating measure. You can select another answer in the meantime (you can change it later). – Huckle Dec 11 '13 at 05:14