First commit
This commit is contained in:
28
scripts/create-php-config.sh
Normal file
28
scripts/create-php-config.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm /etc/php-fpm.d/www.conf
|
||||
|
||||
cat <<EOF > /etc/php-fpm.d/$user.conf
|
||||
|
||||
[$user]
|
||||
|
||||
user = $user
|
||||
group = $user
|
||||
listen = /run/php-fpm/www.sock
|
||||
listen.owner = nginx
|
||||
listen.group = nginx
|
||||
|
||||
pm = static
|
||||
pm.max_children = 25
|
||||
pm.max_requests = 1000
|
||||
|
||||
slowlog = /var/log/nginx/error_log
|
||||
request_slowlog_timeout = 3s
|
||||
|
||||
php_admin_value[error_log] = /var/log/nginx/error_log
|
||||
php_admin_flag[log_errors] = on
|
||||
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache
|
||||
|
||||
EOF
|
||||
|
||||
exit 0
|
64
scripts/create-vhost.sh
Normal file
64
scripts/create-vhost.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
alias_block=''
|
||||
|
||||
#Create Server Alias Block
|
||||
if [ ! -z $serveralias ]; then
|
||||
for alias in $(echo $serveralias | tr ',' ' ')
|
||||
do
|
||||
alias_block=$alias_block"ServerAlias $alias
|
||||
"
|
||||
done
|
||||
fi
|
||||
|
||||
cat <<EOF > /etc/nginx/conf.d/$domain.conf
|
||||
|
||||
# Upstream to abstract backend connection(s) for php
|
||||
upstream php {
|
||||
server unix:/run/php-fpm/www.sock;
|
||||
}
|
||||
|
||||
server {
|
||||
## Your website name goes here.
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
#server_name $domain;
|
||||
## Your only path reference.
|
||||
root /home/$user/public_html;
|
||||
## This should be in your http block and if it is, it's not needed here.
|
||||
index index.php;
|
||||
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location / {
|
||||
# This is cool because no php is touched for static content.
|
||||
# include the "?\$args" part so non-default permalinks doesn't break when using query string
|
||||
try_files \$uri \$uri/ /index.php?\$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
||||
include fastcgi_params;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_pass php;
|
||||
#The following parameter can be also included in fastcgi_params file
|
||||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
|
||||
}
|
||||
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
||||
expires max;
|
||||
log_not_found off;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EOF
|
40
scripts/entrypoint.sh
Normal file
40
scripts/entrypoint.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
adduser -u $uid $user
|
||||
|
||||
mkdir -p /home/$user/public_html
|
||||
|
||||
chown -R $user:$user /home/$user
|
||||
chmod -R 755 /home/$user
|
||||
|
||||
/scripts/create-vhost.sh
|
||||
/scripts/create-php-config.sh
|
||||
|
||||
/usr/sbin/nginx
|
||||
/usr/sbin/php-fpm -y /etc/php-fpm.conf
|
||||
|
||||
if [[ $environment == 'DEV' ]]; then
|
||||
echo "Starting Dev Deployment"
|
||||
yum install -y MariaDB-server MariaDB-client
|
||||
nohup mysqld -umysql &
|
||||
if [ ! -f /var/lib/mysql/creds ]; then
|
||||
echo "Give MySQL a chance to finish starting..."
|
||||
sleep 10
|
||||
mysql_user=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo '')
|
||||
mysql_password=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 18 ; echo '')
|
||||
mysql_db=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 6 ; echo '')
|
||||
mysql -e "CREATE DATABASE devdb_"$mysql_db";"
|
||||
mysql -e "CREATE USER '"$mysql_user"'@'localhost' IDENTIFIED BY '"$mysql_password"';"
|
||||
mysql -e "GRANT ALL PRIVILEGES ON *.* TO '"$mysql_user"'@'localhost' WITH GRANT OPTION;"
|
||||
mysql -e "FLUSH PRIVILEGES;"
|
||||
echo "MySQL User: "$mysql_user > /var/lib/mysql/creds
|
||||
echo "MySQL Password: "$mysql_password >> /var/lib/mysql/creds
|
||||
echo "MySQL Database: devdb_"$mysql_db >> /var/lib/mysql/creds
|
||||
cat /var/lib/mysql/creds
|
||||
fi
|
||||
/usr/bin/memcached -d -u $user
|
||||
fi
|
||||
tail -f /var/log/nginx/*
|
||||
|
||||
exit 0
|
||||
|
6
scripts/install-php74.sh
Normal file
6
scripts/install-php74.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
dnf module enable php:remi-7.4 -y
|
||||
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-xmlrpc \
|
||||
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
|
||||
php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd libzip php-cli
|
||||
exit 0
|
6
scripts/install-php80.sh
Normal file
6
scripts/install-php80.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
dnf module enable php:remi-8.0 -y
|
||||
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
|
||||
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
|
||||
php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd libzip php-cli
|
||||
exit 0
|
6
scripts/install-php81.sh
Normal file
6
scripts/install-php81.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
dnf module enable php:remi-8.1 -y
|
||||
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
|
||||
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
|
||||
php-mysqlnd php-mbstring php-ioncube-loader php-intl php-gd libzip php-cli
|
||||
exit 0
|
6
scripts/install-php82.sh
Normal file
6
scripts/install-php82.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
dnf module enable php:remi-8.2 -y
|
||||
dnf install -y php php-fpm php-mysqlnd php-xml php-pecl-zip php-sodium php-soap php-pecl-xmlrpc \
|
||||
php-pecl-redis5 php-pecl-memcached php-pecl-memcache php-pecl-ip2location php-pecl-imagick php-pecl-geoip \
|
||||
php-mysqlnd php-mbstring php-intl php-gd libzip php-cli
|
||||
exit 0
|
Reference in New Issue
Block a user