0

So I am developing a simple installation script for a Raspberry based app. It installs the LAMP install, grants some permissions among other things. And part of the process is to change the apache DocumentRoot to point to /home/pi/bticino

Is there a command or set of commands to achieve this? I'd like a command that avoids replacing files. And editing the httpd.conf file is not an option (as there should not be human interaction on my script).

1 Answer 1

2

The standard Debian way of doing this is to provide a complete virtual host configuration as a new file in /etc/apache2/sites-available, then enable it using a2ensite (and perhaps disable the default using a2dissite).

So you'd create say /etc/apache2/sites-available/bticino.conf containing

<VirtualHost *:80>
    DocumentRoot /home/pi/bticino
    ErrorLog ${APACHE_LOG_DIR}/bticino-error.log
    CustomLog ${APACHE_LOG_DIR}/bticino-access.log combined
</VirtualHost>

then run

a2dissite 000-default
a2ensite bticino
service apache2 reload

all as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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