Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using Ubuntu 12.10, and I know that if I place a php file (index.php) under /var/www, and I visit localhost:80/index.php, it will work fine.

However, say that I have multiple projects in order folders in directories such as:

/home/myuser/Projects/Joomla

and

/home/myuser/Work/testphp

What are my alternatives in order to make Apache be able to read those folders? I know I have these possibilities:

  • Create symlinks (but I haven't been able to find out which permissions/groups should I set and why?)

  • Add VirtualHosts (I haven't found a resource that will explain how to use VirtualHosts for this situation).

Could anyone tell me what are my possibilities and which one is the best and why?

share|improve this question
    
What URLs do you want the files in those other directories to be accessible at? There are a few different methods to use, depending on the answer to that question. Or is your problem that Apache is not even able to access the files and you want to know how to set permissions to allow it to do so? –  David Z Feb 2 at 1:00
    
Hi David Z. It's a conceptual question, I want to know how to tell Apache to be able to access all the files from those folders, they are basically a Joomla project. –  Hommer Smith Feb 2 at 3:43
    
What do you mean by "I haven't found a resource that will explain how to use VirtualHosts"? You mean, that you cannot make calls with different "Host:" headers or you couldn't find an example for different VirtualHosts with different DocumentRoots? –  csikos.balint Feb 2 at 17:17

1 Answer 1

Follow these steps:

1. Edit the default configuration file:

vi /etc/apache2/sites-available/default.conf

and add this line:

DocumentRoot /home/myuser

2. Create a new site configuration file:

touch /etc/apache2/sites-available/yourSite.conf
vi /etc/apache2/sites-available/yourSite.conf

<VirtualHost *:80> 

ServerName Joomla
DocumentRoot /home/myuser/Projects/Joomla
    <Directory /home/myuser/Projects/Joomla>
            AllowOverride all
            Options all
    </Directory>

</VirtualHost>

3. Reload your server:

service apache2 reload

You may can access now putting Joomla on the URL. If doesn't work, you should create the symlink:

ln -s /etc/apache2/sites-available/yourSite.conf /etc/apache2/sites-enabled/yourSite.conf
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.