1

I have a PHP project located at:

/home/hommer/Projects/Joomla

I know that if I place the project itself in /var/www/Joomla it would work, but how can I tell Apache to go and look in that directory, or if in the future I have another directory, to look into that other directory too?

I am under Ubuntu 12.10.

6
  • 2
    Have you tried anything? There are many tutorials on how to configure Apache including changing www-root directory. Commented Feb 1, 2014 at 21:14
  • dragoste, I have read through tutorials and I haven't been able to figure out. That's why I asked. Commented Feb 1, 2014 at 21:32
  • I don't wanna change www-root directory, I just want it to take into accounts other directories. Commented Feb 1, 2014 at 21:33
  • You probably need to configure VirtualHost. But since it's directory will be outside www-root directory, there may be some issues with access permissions etc. Try something, then come back to us if you won't be able to handle this on your own. But only if you have a specific problem! Commented Feb 1, 2014 at 21:35
  • dragoste, the problem is specific, don't you think? Commented Feb 1, 2014 at 21:44

3 Answers 3

1

You could use a symlink (symbolic link) in /var/www to point to /home/hommer/Projects/Joomla.

$ cd /var/www
$ sudo ln -s /home/hommer/Projects/Joomla Joomla

Then you will have to configure the right permissions.

Also, if you want to do that, check that your Apache configuration allows this, by adding FollowSymLinks in /etc/apache2/sites-available/000-default.conf (or the config file you're using for /var/www):

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    ...
</Directory>

Eventually, the complete path must be executable by Apache, so you can do that:

$ sudo o+x chmod /home /home/hommer /home/hommer/Projects /home/hommer/Projects/Joomla
Sign up to request clarification or add additional context in comments.

5 Comments

Why would the symlink be at /Joomla? That is going to put it in the "/". Shouldn't it be just Joomla?
Yeah you're right - I don't know how this "/" landed there :)
Hi Jivan. I have FollowSymLinks in my configuration. But when trying to access the Joomla folder, I see the following "You don't have permission to access /Joomla/test.php on this server." Which kind of permisisons/groups should I set?
Hi. This question is tricky to be answered in a comment :) You have a fully explained, quite complete answer in this SO topic here: stackoverflow.com/questions/7381371/… - and also here on AskUbuntu: askubuntu.com/questions/142084/apache-gives-403-forbidden
@HommerSmith I just edited my answer. It was not so long after all :)
1

Open httpd.conf and search for this directive: <Directory "/var/www/Joomla"> There you can point to a new directory, in your situation: <Directory "/home/hommer/Projects/Joomla"> then reload Apache configuration:

sudo reload apache2

Comments

0

Generally Apache will look in the public folder which should be located in the root of your project directory. You can configure Apache on a project level by placing .htaccess file also in your project directory, and provide Apache directives related to your project. In .htaccess you can tell Apache to look for any file, by your specification. Also if you are on Ubuntu (not only Ubuntu) you can change host name (/etc/hosts) , and add new Apache virtual hosts (/etc/apache2/sites-enabled).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.