Hommer Smith
Hommer Smith

Reputation: 27852

PHP Project in /home/user/Projects - How to configure apache?

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.

Upvotes: 1

Views: 2353

Answers (3)

Jivan
Jivan

Reputation: 23078

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

Upvotes: 1

Miroslav Trninic
Miroslav Trninic

Reputation: 3455

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).

Upvotes: 0

H A&#223;d&#248;&#181;
H A&#223;d&#248;&#181;

Reputation: 3055

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

Upvotes: 1

Related Questions