apache-add-vhost: updated with logrotate support and fix for password setting [release 2.4.12-3mamba;Thu Mar 12 2015]

This commit is contained in:
Silvan Calarco 2024-01-05 20:27:08 +01:00
parent 69cfba0e59
commit 0696954893
2 changed files with 28 additions and 5 deletions

View File

@ -59,8 +59,8 @@ getent passwd $SERVERUSER >/dev/null && {
exit 1
}
[ -e /etc/httpd/httpd.d/${SITEURL}.conf ] && {
echo "ERROR: a virtual host for ${SITEURL} is already configured; aborting."
[ -e /etc/httpd/httpd.d/${SERVERNAME}.conf ] && {
echo "ERROR: a virtual host for ${SERVERNAME} is already configured; aborting."
exit 1
}
@ -79,7 +79,7 @@ useradd ${SERVERUSER} -g sftponly -d ${SERVERROOT} -p ${SERVERPASSWORD} -c "${SE
exit 1
}
echo ${SERVERPASSWORD} | passwd ${SERVERPASSWORD} --stdin || {
echo ${SERVERPASSWORD} | passwd ${SERVERUSER} --stdin || {
echo "ERROR: unable to set password for ${SERVERUSER}; aborting."
exit 1
}
@ -87,7 +87,7 @@ echo ${SERVERPASSWORD} | passwd ${SERVERPASSWORD} --stdin || {
mkdir -p ${DOCUMENTROOT} ${LOGROOT}
chown ${SERVERUSER}.sftponly ${DOCUMENTROOT}
cat > /etc/httpd/httpd.d/${SITEURL}.conf << _EOF
cat > /etc/httpd/httpd.d/${SERVERNAME}.conf << _EOF
<VirtualHost *:80>
ServerAdmin $SERVERADMIN
DocumentRoot $DOCUMENTROOT
@ -107,6 +107,26 @@ cat > /etc/httpd/httpd.d/${SITEURL}.conf << _EOF
</Directory>
_EOF
cat > /etc/logrotate.d/${SERVERNAME} << _EOF
${ACCESSLOG} {
monthly
rotate 12
copytruncate
compress
notifempty
missingok
}
${ERRORLOG} {
monthly
rotate 12
copytruncate
compress
notifempty
missingok
}
_EOF
apachectl configtest >/dev/null || {
echo "ERROR: there is a problem in Apache configuration, so I won't reload it; aborting."
exit 1

View File

@ -6,7 +6,7 @@
Name: apache
Version: 2.4.12
Release: 2mamba
Release: 3mamba
Epoch: 1
Summary: The Apache webserver
Group: System/Servers
@ -435,6 +435,9 @@ exit 0
%{_libdir}/apache/mod_suexec.so
%changelog
* Thu Mar 12 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.4.12-3mamba
- apache-add-vhost: updated with logrotate support and fix for password setting
* Thu Feb 12 2015 Silvan Calarco <silvan.calarco@mambasoft.it> 2.4.12-2mamba
- added apache-add-vhost and sftponly group to simplify virtualhosts creation with sftp access
- removed obsolete sysv initscript