Source

iredmail / iRedMail / conf / web_server

Full commit
#!/usr/bin/env bash

# Author: Zhang Huangbin (zhb _at_ iredmail.org)

#---------------------------------------------------------------------
# This file is part of iRedMail, which is an open source mail server
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedMail is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedMail is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------

# web servers and PHP

export HTTPD_PORT='80'
export HTTPS_PORT='443'

if [ X"${DISTRO}" == X"RHEL" ]; then
    # Web data.
    export HTTPD_SERVERROOT='/var/www'
    export HTTPD_DOCUMENTROOT="${HTTPD_SERVERROOT}/html"

    # Daemon user.
    export HTTPD_USER='apache'
    export HTTPD_GROUP='apache'

elif [ X"${DISTRO}" == X"DEBIAN" -o X"${DISTRO}" == X"UBUNTU" ]; then
    # Web data.
    export HTTPD_SERVERROOT='/usr/share/apache2'
    export HTTPD_DOCUMENTROOT="/var/www"

    # Daemon user.
    export HTTPD_USER='www-data'
    export HTTPD_GROUP='www-data'

elif [ X"${DISTRO}" == X"FREEBSD" ]; then
    # Web data.
    export HTTPD_SERVERROOT='/usr/local/www'
    export HTTPD_DOCUMENTROOT="${HTTPD_SERVERROOT}/apache22/data"

    # Daemon user.
    export HTTPD_USER='www'
    export HTTPD_GROUP='www'

elif [ X"${DISTRO}" == X'OPENBSD' ]; then
    # Web data.
    export HTTPD_SERVERROOT='/var/www'
    export HTTPD_DOCUMENTROOT="${HTTPD_SERVERROOT}/htdocs"

    # Daemon user.
    export HTTPD_USER='www'
    export HTTPD_GROUP='www'
fi


. ${CONF_DIR}/apache_php
. ${CONF_DIR}/nginx

if [ X"${WEB_SERVER_USE_APACHE}" == X'YES' ]; then
    export ENABLED_HTTPD_SERVICES="${APACHE_RC_SCRIPT_NAME}"
    export DISABLED_HTTPD_SERVICES="${NGINX_RC_SCRIPT_NAME} ${PHP_FPM_RC_SCRIPT_NAME} ${UWSGI_RC_SCRIPT_NAME}"
fi

if [ X"${WEB_SERVER_WEB_SERVER_USE_NGINX}" == X'YES' ]; then
    # Use Nginx as web server if it's selected.
    # php-fpm will be listed in variable 'pkg_scripts' in /etc/rc.conf.local.
    export ENABLED_HTTPD_SERVICES="${NGINX_RC_SCRIPT_NAME} ${PHP_FPM_RC_SCRIPT_NAME} ${UWSGI_RC_SCRIPT_NAME}"
    export DISABLED_HTTPD_SERVICES="${APACHE_RC_SCRIPT_NAME}"
fi

# PHP
export PHP_DISABLED_FUNCTIONS='show_source,system,shell_exec,passthru,exec,phpinfo,proc_open'

# PHP connection type: mysql, mysqli (recommended).
export PHP_CONN_TYPE='mysqli'
[ X"${BACKEND}" == X"PGSQL" ] && export PHP_CONN_TYPE='pgsql'