gitea_webhooks/start.sh

31 lines
2.0 KiB
Bash
Raw Normal View History

2021-01-12 21:53:49 +00:00
#!/bin/sh
source /etc/profile.d/php7.sh
sed -i "s|;listen.owner\s*=\s*nobody|listen.owner = ${PHP_FPM_USER}|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|;listen.group\s*=\s*nobody|listen.group = ${PHP_FPM_GROUP}|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|;listen.mode\s*=\s*0660|listen.mode = ${PHP_FPM_LISTEN_MODE}|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|user\s*=\s*nobody|user = ${PHP_FPM_USER}|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|group\s*=\s*nobody|group = ${PHP_FPM_GROUP}|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|;log_level\s*=\s*notice|log_level = notice|g" /etc/php7/php-fpm.d/www.conf
sed -i "s|display_errors\s*=\s*Off|display_errors = ${PHP_DISPLAY_ERRORS}|i" /etc/php7/php.ini
sed -i "s|display_startup_errors\s*=\s*Off|display_startup_errors = ${PHP_DISPLAY_STARTUP_ERRORS}|i" /etc/php7/php.ini
sed -i "s|error_reporting\s*=\s*E_ALL & ~E_DEPRECATED & ~E_STRICT|error_reporting = ${PHP_ERROR_REPORTING}|i" /etc/php7/php.ini
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php7/php.ini
sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = ${PHP_MAX_UPLOAD}|i" /etc/php7/php.ini
sed -i "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" /etc/php7/php.ini
sed -i "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /etc/php7/php.ini
sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= ${PHP_CGI_FIX_PATHINFO}|i" /etc/php7/php.ini
sed -i "s/\$SMTP_HOST/$SMTP_HOST/g;s/\$SMTP_PORT/$SMTP_PORT/g;s/\$SMTP_FROM/$SMTP_FROM/g;s/\$SMTP_USER/$SMTP_USER/g;s/\$SMTP_PASSWORD/$SMTP_PASSWORD/g;s/\$SMTP_ENCRYPTION/$SMTP_ENCRYPTION/g" /etc/msmtprc
sed -i "s/\$SMTP_HOST/$SMTP_HOST/g;s/\$SMTP_PORT/$SMTP_PORT/g;s/\$SMTP_FROM/$SMTP_FROM/g;s/\$SMTP_USER/$SMTP_USER/g;s/\$SMTP_PASSWORD/$SMTP_PASSWORD/g;s/\$SMTP_ENCRYPTION/$SMTP_ENCRYPTION/g" /etc/aliases
sed -i "s/%%SECRETKEY%%/$SECRET_KEY/g;s/%%RECIPIENTS_PR%%/$RECIPIENTS_PR/g" /www/config.php
chown www:www /var/log/nginx/*
ln -sf /usr/bin/msmtp /usr/sbin/sendmail
nginx
su www
php-fpm7 -F