Changing default Apache webroot in Ubuntu

Changing default Apache webroot in Ubuntu

By default the webroot for apache/php is in /var/www

To change this, say, to /home/user/workspace/public_html

1 Go to file: /etc/apache2/sites-available/default
2. Change the /var/www to /home/user/workspace/public_html – as simple as this!!

OR,

If you are changing root just to abscond some difficulty from your IDE or just for temporary purpose, you can use the symlik: just open your terminal and –
cd /home/user/workspace/public_html
ln -s /var/www/project project

See how you would solve these known algorithm problems

Implement Queue Using two Stacks – JavaScript algorithm

Get maximum occurring character

Implementing tokenizer and adding tokens to the linked list

testing k complementary pairs algorithm with junit

String Ordered Permutation Algorithm Problem

Changing decimal number to its binary equivalent

Find longest palindrom from sequence of characters

Java solution for checking anagram strings – tell if phrases are anagrams

Finding missing numbers from billion sequential number list file

Flatten nested javascript array

2 Comments
  1. Vinny Benson

    I am new to Ubuntu(Just installed it 3 hours ago), I have a problem, it wont let me edit the “default” file located in “etcapache2sites-available” as it is set to read only, but when i go to properties the permissions tab page is grayed out, how can i edit the file

    1. gullele

      Hello Vinny, Sorry, was busy these days and was not able to respond fast.
      The problem is probably with the owner of the file. Some file in the Ubuntu would not be available to be edited unless you logged as root.
      In your case you have two options to do:
      1 is to log as root and edit it
      2. to use sudo access
      I will explain the second one as it is too easy

      Step:
      1. Go to Applications (if u have default Ubuntu theme, it would be on the top left menu) -> Accessories -> Terminal
      2. On the terminal enter the following command:
      Sudo gedit /etc/apache2/sites-available
      3. You would be prompted for a password and enter the password
      4. you would get the sites-available file in text editor.

      *You can also change the owner of the file so that you can simply open it using the command chown, but it is not recommended to do that.
      Let me know if this helped,
      thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*