我需要这个脚本的简短版本
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
我可以 cp apache-conf/*.conf/etc/apache2/sites-available
但如何启用它们中的每一个?
最佳答案
请使用以下指令
find /etc/apache2/sites-available/ -type f -and -not -name "*default*" -exec a2ensite {} \;
这会找到所有名称中没有“default”的配置文件并激活它们。
如果遇到任何错误,请查看此线程 学分:https://askubuntu.com/questions/916377/how-to-enable-all-site-confs-with-a2ensite-while-passing-over-000-default-conf/917701
关于linux - 如何复制所有 .conf 文件并在 ubuntu-apache 环境中启用它们中的每一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54396959/