where apache locates localhost?

Asked by pdo100

I just installed Apache server, and I would like to know in which folder apache server defines its localhost? Where can I find it and may I change the location?
Also as far as I know if its in File System I will not be able to change location for localhost as I have no permission, so how can I do it? I am the only user...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:
Revision history for this message
Gerry (gerrydm) said :
#1

Apache 2.x uses the file /etc/apache2/sites-available/default to serve a default page if no other configuration takes precedence. You are probably referring to this behavior.

The default location for the Apache root is in /var/www/. You may have to become root in order to edit/add/delete files and directories in that directory.

Revision history for this message
pdo100 (piotrdomowicz) said :
#2

I have tried to log in as root, but I think I must use only terminal as it doesn't allow me to log in with GUI- and there is a problem... I have many files and while developing dynamic web site I must test it quite often so this solution with terminal only is no good for me... is there a way to log in as root with GUI?

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#3

Why do you want login as root...? You can easily change the permission or owner to related file and/or directory.
To change the owner of files from a terminal in a "test environment" type:
sudo chown your_username -R /var/www/apache2-default

But in a TEST environment i think is better:

1) - create a www subdir into your home_directory

sudo mkdir ~/www
sudo chown -R your_username ~/www

2) - and than edit the 000-default
sudo gedit /etc/apache2/sites-enabled/000-default

and change your DocumentRoot as the line as below
        DocumentRoot /home/your_username/www/

3) Write a default.html file into your www diretory

4) Restart apache2
sudo /etc/init.d/apache2 restart

5) Open it into a browser http://127.0.0.1

For more deep info in a terminal type:
man chmod
man chown
man apache2

and for apache2 related question:
http://httpd.apache.org/

HTH

Revision history for this message
pdo100 (piotrdomowicz) said :
#4

Thanks elart.it, that solved my question.