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