I need a short version of this script
cp apache-conf/site1.conf /etc/apache2/sites-available
cp apache-conf/site2.conf /etc/apache2/sites-available
cp apache-conf/site..N.conf /etc/apache2/sites-available
a2ensite site1
a2ensite site2
a2ensite site..N
I can cp apache-conf/*.conf /etc/apache2/sites-available
but how about enabling each of them?
2
Answers
Please Use the following command
This finds all your configuration files that are not having “default” in their name and activates them.
If you face any errors, please have a look at this thread
Credits: https://askubuntu.com/questions/916377/how-to-enable-all-site-confs-with-a2ensite-while-passing-over-000-default-conf/917701
You can make use of the powerhouse built-in utils in
bash
that allows globbing with the number on the part of the filenameAssuming
N
is static and not known at run-time, you can do something as below. Consider a case of being it10
and for running the command
a2ensite
on the destination path