#!/bin/bash
+CONFDIR=/etc/httpd
+
hvconfig_pre()
{
cd ${LFS_TMP}/${PACKAGE}
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec/apache
mandir: ${prefix}/share/man
- sysconfdir: /etc/apache
+ sysconfdir: /etc/httpd
datadir: /srv/www
installbuilddir: ${libexecdir}/build
errordir: ${datadir}/error
/usr/share/man/man1/{ab,apxs,dbmmanage,ht{dbm,digest,passwd,txt2dbm},logresolve}.1 \
/usr/share/man/man8/{apachectl,htcacheclean,httpd,rotatelogs,suexec}.8 &&
- sed -i -e "s!^\(DocumentRoot\) .*!\1 /srv/www/htdocs!" /etc/apache/httpd.conf
+ sed -i -e "s!^\(DocumentRoot\) .*!\1 /srv/www/htdocs!" /etc/httpd/httpd.conf
# Modifying the listening port if an alternate one is specified.
if [ -n "${HTTPD_PORT}" ]; then
- if ! grep -q "Listen ${HTTPD_PORT}" /etc/apache/httpd.conf; then
+ if ! grep -q "Listen ${HTTPD_PORT}" ${CONFDIR}/httpd.conf; then
# Adding alternate port to default port of 80
sed -i -e "s%\(Listen 80\)%\1\nListen ${HTTPD_PORT}%" \
- /etc/apache/httpd.conf
+ ${CONFDIR}/httpd.conf
fi
fi
sed -i \
-e "s!^\(User\).*!\1 ${APACHE_USER}!g" \
-e "s!^\(Group\).*!\1 ${APACHE_USER}!g" \
- /etc/apache/httpd.conf
+ ${CONFDIR}/httpd.conf
# SSL Certificates generation script
- cat > /etc/apache/generate-ssl-certs << "EOF"
+ cat > ${CONFDIR}/generate-ssl-certs << "EOF"
#!/bin/bash
# Creation of SSL directories for Apache
-cd /etc/apache
+cd ${CONFDIR}
mkdir -p ssl
cd ssl
exit $?
EOF
- chmod 740 /etc/apache/generate-ssl-certs
+ chmod 740 ${CONFDIR}/generate-ssl-certs
- mkdir -p /etc/apache/ssl
- cp /etc/apache/extra/httpd-ssl.conf /etc/apache/ssl/ssl.conf
+ mkdir -p ${CONFDIR}/ssl
+ cp ${CONFDIR}/extra/httpd-ssl.conf ${CONFDIR}/ssl/ssl.conf
- sed -i -e "s!^<IfModule ssl_module>!<IfModule ssl_module>\n Include /etc/apache/ssl/ssl.conf!" /etc/apache/httpd.conf
+ sed -i -e "s!^<IfModule ssl_module>!<IfModule ssl_module>\n Include ${CONFDIR}/ssl/ssl.conf!" ${CONFDIR}/httpd.conf
mkdir -p /srv/www/htdocs/ssl
- sed -i -e "s!^DocumentRoot .*!DocumentRoot /srv/www/htdocs/ssl!" /etc/apache/ssl/ssl.conf
- sed -i -e "s!^ServerName .*:443!ServerName www.${DOMAIN}:443!" /etc/apache/ssl/ssl.conf
- sed -i -e "s!^ServerAdmin .*!ServerAdmin webmaster@${DOMAIN}!" /etc/apache/ssl/ssl.conf
- sed -i -e "s!/etc/apache!/etc/apache/ssl!" /etc/apache/ssl/ssl.conf
+ sed -i -e "s!^DocumentRoot .*!DocumentRoot /srv/www/htdocs/ssl!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!^ServerName .*:443!ServerName www.${DOMAIN}:443!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!^ServerAdmin .*!ServerAdmin webmaster@${DOMAIN}!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!${CONFDIR}!${CONFDIR}/ssl!" ${CONFDIR}/ssl/ssl.conf
chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/www
# To enable PHP support in the Apache web server, a new AddType directive
# must be added to the httpd.conf file.
- if ! grep -q "application/x-httpd-php" /etc/apache/httpd.conf; then
- echo "AddType application/x-httpd-php .php" >> /etc/apache/httpd.conf
+ if ! grep -q "application/x-httpd-php" /etc/httpd/httpd.conf; then
+ echo "AddType application/x-httpd-php .php" >> /etc/httpd/httpd.conf
fi
# Est-ce nécessaire?
#cgi.discard_path = 1
- if ! grep -q "DirectoryIndex" /etc/apache/httpd.conf | grep "index.php"; then
+ if ! grep -q "DirectoryIndex" /etc/httpd/httpd.conf | grep "index.php"; then
sed -i -e "s!\(^\s*DirectoryIndex index.html.*\)!\1 index.php!g" \
- /etc/apache/httpd.conf
+ /etc/httpd/httpd.conf
fi
}