Update 'resources/wordpress.sh'

This commit is contained in:
b.waal
2019-09-10 09:48:45 +02:00
parent 78e240cc47
commit ed036bebfd

View File

@@ -1,78 +1,79 @@
#============================================================================== #==============================================================================
# INSTALL SECOND WEBSITE WITH WORDPRESS # INSTALL SECOND WEBSITE WITH WORDPRESS
#============================================================================== #==============================================================================
echo Welk domein mag gekoppeld worden? Typ domein zonder www echo Welk domein mag gekoppeld worden? Typ domein zonder www
read domain read domain
echo Standaard wachtwoord? echo Standaard wachtwoord?
read passwd read passwd
echo Database user en name? echo Database user en name?
read db_name db_user read db_name db_user
echo Standaard wachtwoord echo Standaard wachtwoord
read passwd read passwd
db_pass=$(date +%s|sha256sum|base64|head -c 32) db_pass=$(date +%s|sha256sum|base64|head -c 32)
#-------------------# #-------------------#
# MYSQL CONFIG # # MYSQL CONFIG #
#-------------------# #-------------------#
mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" mysql -u root -p"$passwd" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" mysql -u root -p"$passwd" -e "GRANT ALL ON "$db_name".* TO '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';"
mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;" mysql -u root -p"$passwd" -e "FLUSH PRIVILEGES;"
#-------------------# #-------------------#
# WP - INSTALL # # WP - INSTALL #
#-------------------# #-------------------#
cd /tmp cd /tmp
curl -LO https://wordpress.org/latest.tar.gz curl -LO https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz tar xzvf latest.tar.gz
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
cp -a /tmp/wordpress/. /var/www/"$domain"/html cp -a /tmp/wordpress/. /var/www/"$domain"/html
chown -R www-data:www-data /var/www/"$domain"/html chown -R www-data:www-data /var/www/"$domain"/html
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -) WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
cat <<EOF > /var/www/"$domain"/html/wp-config.php cat <<EOF > /var/www/"$domain"/html/wp-config.php
<?php <?php
define('DB_NAME', '$db_name'); define('DB_NAME', '$db_name');
define('DB_USER', '$db_user'); define('DB_USER', '$db_user');
define('DB_PASSWORD', '$db_pass'); define('DB_PASSWORD', '$db_pass');
define('DB_HOST', 'localhost'); define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8'); define('DB_CHARSET', 'utf8');
define('DB_COLLATE', ''); define('DB_COLLATE', '');
#define( 'WP_SITEURL', '' ); #define( 'WP_SITEURL', '' );
#define( 'WP_HOME', '' ); define('FS_METHOD','direct');
#define( 'ALTERNATE_WP_CRON', true ); #define( 'WP_HOME', '' );
#define('DISABLE_WP_CRON', 'true'); #define( 'ALTERNATE_WP_CRON', true );
#define('WP_CRON_LOCK_TIMEOUT', 900); #define('DISABLE_WP_CRON', 'true');
#define('AUTOSAVE_INTERVAL', 300); #define('WP_CRON_LOCK_TIMEOUT', 900);
define( 'WP_MEMORY_LIMIT', '256M' ); #define('AUTOSAVE_INTERVAL', 300);
#define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); define( 'WP_MEMORY_LIMIT', '256M' );
#define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) ); #define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
#define( 'WP_ALLOW_REPAIR', true ); #define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );
#define( 'FORCE_SSL_ADMIN', true ); #define( 'WP_ALLOW_REPAIR', true );
#define( 'AUTOMATIC_UPDATER_DISABLED', true ); #define( 'FORCE_SSL_ADMIN', true );
#define( 'WP_AUTO_UPDATE_CORE', false ); #define( 'AUTOMATIC_UPDATER_DISABLED', true );
$WPSalts #define( 'WP_AUTO_UPDATE_CORE', false );
\$table_prefix = '$db_name'; $WPSalts
\$table_prefix = '$db_name';
define('WP_DEBUG', false);
if ( !defined('ABSPATH') ) define('WP_DEBUG', false);
define('ABSPATH', dirname(__FILE__) . '/'); if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
#\$memcached_servers = array(
# 'default' => array( #\$memcached_servers = array(
# '127.0.0.1:11211' # 'default' => array(
# ) # '127.0.0.1:11211'
#); # )
#define('WP_REDIS_HOST', '127.0.0.1'); #);
#define('WP_REDIS_PASSWORD', '$passwd'); #define('WP_REDIS_HOST', '127.0.0.1');
#define('WP_REDIS_PORT', '6379'); #define('WP_REDIS_PASSWORD', '$passwd');
require_once(ABSPATH . 'wp-settings.php'); #define('WP_REDIS_PORT', '6379');
EOF require_once(ABSPATH . 'wp-settings.php');
#-------------------# EOF
# OPCACHE GUI # #-------------------#
#-------------------# # OPCACHE GUI #
cd /tmp #-------------------#
curl -LO https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php cd /tmp
cp /tmp/index.php /tmp/opcache.php curl -LO https://raw.githubusercontent.com/amnuts/opcache-gui/master/index.php
cp -a /tmp/opcache.php /var/www/"$domain"/html cp /tmp/index.php /tmp/opcache.php
cat > /var/www/"$domain"/html/info.php <<- "EOF" cp -a /tmp/opcache.php /var/www/"$domain"/html
<?php cat > /var/www/"$domain"/html/info.php <<- "EOF"
phpinfo(); <?php
?> phpinfo();
?>
EOF EOF