I have a development machine with lamp setup. Now to add virtual hosts this is what I do currently:
- add a virtual host file
in the /etc/apache2/sites-available... - add the virtual host using
sudo a2ensite
- sudo service apache2 restart
This works fine and I get the desired site up and running on my localhost.
Now the problem is that every time I have to make some change to the configuration file for a site, I have to sudo to edit the configuration file.
What I was wondering is if it is possible to specify some directory in my home folder where apache can look for configuration files for the sites instead of the default sites-enabled directory.
Answer
You can create a directory wherever you want and make the permissions to fit like you want.
In Apache conf (/etc/apache2/apache2.conf) you can include the config files in that directory
Include /path/to/dir/*.conf
Apache will have to be restarted when a configuration change has occured even if you choose this solution.
Also note, that the files in there will be included when apache is restarted - there is no need for a2ensite, and nor can you disable the config files with a2dissite. The way to disable a config file included this way would be to remove or change the extension to something else than .conf.
Remember to take the possible risks into account. You will need to give sudo access, but you can give sudo access to "/etc/init.d/apache2 reload" - the reload parameter will do a configtest before restarting the httpd. If the configtest fails, it will not restart Apache.
I am assuming you run Debian or Ubunbu.
No comments:
Post a Comment