diff options
author | Ramón M. Gómez <ramongomez@us.es> | 2018-10-04 11:57:06 +0200 |
---|---|---|
committer | Ramón M. Gómez <ramongomez@us.es> | 2018-10-04 11:57:06 +0200 |
commit | 9215580935651b48edc831a2f18adf52da9b3750 (patch) | |
tree | 5fc25c570b0fa20070008fb35b3c11dde36d1cf2 | |
parent | ea01a0db9f0d19f6f87a4c26de3679e5cc634e3f (diff) |
#784: Using PHP-FPM instead of Mod-PHP to improve Apache performance.
-rw-r--r-- | doc/CHANGELOG.es.txt | 4 | ||||
-rwxr-xr-x | installer/opengnsys_installer.sh | 24 | ||||
-rwxr-xr-x | installer/opengnsys_update.sh | 16 | ||||
-rw-r--r-- | server/etc/apache.conf.tmpl | 7 |
4 files changed, 36 insertions, 15 deletions
diff --git a/doc/CHANGELOG.es.txt b/doc/CHANGELOG.es.txt index fbd8408a..4a966140 100644 --- a/doc/CHANGELOG.es.txt +++ b/doc/CHANGELOG.es.txt @@ -7,6 +7,10 @@ Lista de cambios incluidos en OpenGnsys 1.1.1 (Espeto) ------------------------------------------------------ Tickets resueltos en módulo OpenGnsys Cloning Engine: +#863 smartPartition: incluir scritps de ejemplo de particionado personalizado para múltiples d +iscos duros +#864 FirstRunOnceWindows: scripts de ejemplo para installMiniSetup con ratón y teclado desacti +vado #866 Si al restaurar usando la cache no hay espacio en la misma se finalizará la acción #868 ConfiguraOs: error al desinstalar el agente de sistema operativo antiguo diff --git a/installer/opengnsys_installer.sh b/installer/opengnsys_installer.sh index ccd4de0e..230458ec 100755 --- a/installer/opengnsys_installer.sh +++ b/installer/opengnsys_installer.sh @@ -141,8 +141,9 @@ OPENGNSYS_DB_CREATION_FILE=opengnsys/admin/Database/${OPENGNSYS_DATABASE}.sql # - STARTSERVICE, ENABLESERVICE - iniciar y habilitar un servicio # - STOPSERVICE, DISABLESERVICE - parar y deshabilitar un servicio # - APACHESERV, APACHECFGDIR, APACHESITESDIR, APACHEUSER, APACHEGROUP - servicio y configuración de Apache -# - APACHESSLMOD, APACHEENABLESSL, APACHEMAKECERT - habilitar módulo Apache y certificado SSL +# - APACHEENABLEMODS, APACHEENABLESSL, APACHEMAKECERT - habilitar módulos y certificado SSL # - APACHEENABLEOG, APACHEOGSITE, - habilitar sitio web de OpenGnsys +# - PHPFPMSERV - servicio PHP FastCGI Process Manager para Apache # - INETDSERV - servicio Inetd # - FIREWALLSERV - servicio de cortabuegos IPTables/FirewallD # - DHCPSERV, DHCPCFGDIR - servicio y configuración de DHCP @@ -169,7 +170,7 @@ OSVERSION="${OSVERSION%%.*}" # Configuración según la distribución GNU/Linux (usar minúsculas). case "$OSDISTRIB" in ubuntu|debian|linuxmint) - DEPENDENCIES=( subversion apache2 php php-ldap libapache2-mod-php mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) + DEPENDENCIES=( subversion apache2 php php-ldap php-fpm libapache2-mod-fastcgi mysql-server php-mysql isc-dhcp-server bittorrent tftp-hpa tftpd-hpa xinetd build-essential g++-multilib libmysqlclient-dev wget curl doxygen graphviz bittornado ctorrent samba rsync unzip netpipes debootstrap schroot squashfs-tools btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast shim-signed grub-efi-amd64-signed ) UPDATEPKGLIST="apt-get update" INSTALLPKG="apt-get -y install --force-yes" CHECKPKG="dpkg -s \$package 2>/dev/null | grep Status | grep -qw install" @@ -188,8 +189,7 @@ case "$OSDISTRIB" in APACHEOGSITE=opengnsys APACHEUSER="www-data" APACHEGROUP="www-data" - APACHESSLMOD="a2enmod ssl" - APACHEREWRITEMOD="a2enmod rewrite" + APACHEENABLEMODS="a2enmod ssl rewrite proxy_fcgi fastcgi actions alias" APACHEENABLESSL="a2ensite default-ssl" APACHEENABLEOG="a2ensite $APACHEOGSITE" APACHEMAKECERT="make-ssl-cert generate-default-snakeoil --force-overwrite" @@ -199,6 +199,7 @@ case "$OSDISTRIB" in INETDCFGDIR=/etc/xinetd.d MYSQLSERV=mysql MARIADBSERV=mariadb + PHPFPMSERV=php-fpm RSYNCSERV=rsync RSYNCCFGDIR=/etc SAMBASERV=smbd @@ -302,6 +303,7 @@ case "$OSDISTRIB" in add-apt-repository -y ppa:ondrej/php eval $UPDATEPKGLIST PHP7VERSION=$(apt-cache pkgnames php7 | sort | head -1) + PHPFPM="${PHP7VERSION}-fpm" DEPENDENCIES=( ${DEPENDENCIES[@]//php/$PHP7VERSION} ) fi # Adaptar dependencias para libmysqlclient. @@ -1138,6 +1140,7 @@ function installWebConsoleApacheConf() local path_opengnsys_base="$1" local path_apache2_confd="$2" local CONSOLEDIR=${path_opengnsys_base}/www + local sockfile if [ ! -d $path_apache2_confd ]; then errorAndLog "${FUNCNAME}(): path to apache2 conf.d can not found, verify your server installation" @@ -1148,12 +1151,17 @@ function installWebConsoleApacheConf() echoAndLog "${FUNCNAME}(): creating apache2 config file.." + # Avtivar PHP-FPM. + echoAndLog "${FUNCNAME}(): configuring PHP-FPM" + service=$PHPFPMSERV + $ENABLESERVICE; $STARTSERVICE + sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) + + # Activar módulos de Apache. + $APACHEENABLEMODS # Activar HTTPS. - $APACHESSLMOD $APACHEENABLESSL $APACHEMAKECERT - # Activar módulo Rewrite. - $APACHEREWRITEMOD # Genera configuración de consola web a partir del fichero plantilla. if [ -n "$(apachectl -v | grep "2\.[0-2]")" ]; then # Configuración para versiones anteriores de Apache. @@ -1161,7 +1169,7 @@ function installWebConsoleApacheConf() $WORKDIR/opengnsys/server/etc/apache-prev2.4.conf.tmpl > $path_apache2_confd/$APACHESITESDIR/${APACHEOGSITE} else # Configuración específica a partir de Apache 2.4 - sed -e "s,CONSOLEDIR,$CONSOLEDIR,g" \ + sed -e "s,CONSOLEDIR,$CONSOLEDIR,g; s,SOCKFILE,$sockfile,g" \ $WORKDIR/opengnsys/server/etc/apache.conf.tmpl > $path_apache2_confd/$APACHESITESDIR/${APACHEOGSITE}.conf fi $APACHEENABLEOG diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh index be36d643..8ebd4080 100755 --- a/installer/opengnsys_update.sh +++ b/installer/opengnsys_update.sh @@ -117,7 +117,7 @@ function autoConfigure() # Configuración según la distribución de Linux. if [ -f /etc/debian_version ]; then # Distribución basada en paquetes Deb. - DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast ) + DEPENDENCIES=( curl rsync btrfs-tools procps arp-scan realpath php-curl gettext moreutils jq wakeonlan udpcast php-fpm libapache2-mod-fastcgi ) UPDATEPKGLIST="add-apt-repository -y ppa:ondrej/php; apt-get update" INSTALLPKGS="apt-get -y install" DELETEPKGS="apt-get -y purge" @@ -132,6 +132,8 @@ function autoConfigure() SERVICESTATUS="eval /etc/init.d/\$service status" fi ENABLESERVICE="eval update-rc.d \$service defaults" + APACHEENABLEMODS="ssl rewrite proxy_fcgi fastcgi actions alias" + APACHEDISABLEMODS="php" APACHEUSER="www-data" APACHEGROUP="www-data" INETDCFGDIR=/etc/xinetd.d @@ -529,15 +531,14 @@ EOT # Configurar HTTPS y exportar usuario y grupo del servicio Apache. function apacheConfiguration () { - local config template + local config template module socketfile - # Activar HTTPS (solo actualizando desde versiones anteriores a 1.0.2) y - # activar módulo Rewrite (solo actualizaciones desde 1.0.x a 1.1.x). + # Activar módulos de Apache. if [ -e $APACHECFGDIR/sites-available/opengnsys.conf ]; then echoAndLog "${FUNCNAME}(): Configuring Apache modules" a2ensite default-ssl - a2enmod ssl - a2enmod rewrite + for module in $APACHEENABLEMODS; do a2enmod -q "$module"; done + for module in $APACHEDISABLEMODS; do a2dismod -q "${module//PHP7VERSION}"; done a2ensite opengnsys elif [ -e $APACHECFGDIR/conf.modules.d ]; then echoAndLog "${FUNCNAME}(): Configuring Apache modules" @@ -551,7 +552,8 @@ function apacheConfiguration () else template=$WORKDIR/opengnsys/server/etc/apache.conf.tmpl fi - sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g" $template > $config + sockfile=$(find /run/php -name "php*.sock" -type s -print 2>/dev/null) + sed -e "s,CONSOLEDIR,$INSTALL_TARGET/www,g; s/SOCKETFILE/$socketfile/g" $template > $config done # Reiniciar Apache. diff --git a/server/etc/apache.conf.tmpl b/server/etc/apache.conf.tmpl index ab49503d..d637c2fe 100644 --- a/server/etc/apache.conf.tmpl +++ b/server/etc/apache.conf.tmpl @@ -2,6 +2,13 @@ Alias /opengnsys CONSOLEDIR +# PHP-FPM configuration +<IfModule proxy_fcgi_module> + <FilesMatch ".+\.ph(p[3457]?|t|tml)$"> + SetHandler "proxy:unix:SOCKFILE|fcgi://localhost" + </FilesMatch> +</IfModule> + RewriteEngine On # Redirect HTTP to HTTPS and default configuration. |