From 9456deb3294710053bf9ce311c6fbc71c7f313e2 Mon Sep 17 00:00:00 2001 From: dimon Date: Sun, 10 Apr 2022 05:25:30 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB(=D0=B0)=20?= =?UTF-8?q?'setup=5Fwordpress.sh'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup_wordpress.sh | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 setup_wordpress.sh diff --git a/setup_wordpress.sh b/setup_wordpress.sh new file mode 100644 index 0000000..fcb8d47 --- /dev/null +++ b/setup_wordpress.sh @@ -0,0 +1,47 @@ +#!/bin/bash +sh /setup_programs.sh + +# Install soft +apt install -y nginx php php-fpm php-mysql php-gd +apt install -y uuid-runtime + +# Configure php +phpVersion="$(php --version | cat -n | sort -nr | cut -f2 | tail -n 1 | cut -d " " -f 2 | cut -c 1,2,3)" +#phpVersion=7.4 +sed -i 's|listen = /run/php/php.\+\?-fpm.sock|listen = 127.0.0.1:9000|g' /etc/php/$phpVersion/fpm/pool.d/www.conf +sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/$phpVersion/fpm/php.ini +sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 8M/g' /etc/php/$phpVersion/fpm/php.ini + +# Install wordpress +cd /tmp +wget https://wordpress.org/latest.tar.gz +mkdir /opt/bitnami/ +tar xfvz latest.tar.gz -C /opt/bitnami/ + +# Configure wordpress conf +wget https://git.dfosd.synology.me/docker/ubuntu-wordpress/raw/branch/master/wp-config.php -O /opt/bitnami/wordpress/wp-config.php +#uuid=$(sed 's/-//g' <<< $(uuidgen)) +#uuid=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 40 | head -n 1) +sed -i "s/secure_auth_key_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/auth_key_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/logged_in_key_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/nonce_key_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/secure_auth_salt_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/auth_salt_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/logged_in_salt_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/nonce_salt_value/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/wordpress_db_name/$wordress_db/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/wordpress_user/$wordpress_user/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/wordress_pwd/$wordpress_pwd/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/wordpress_host/$wordpress_host/g" /opt/bitnami/wordpress/wp-config.php +sed -i "s/wordpress_https/$wordpress_https/g" /opt/bitnami/wordpress/wp-config.php + +# Configure wordpress permission +chown -R www-data:www-data /opt/bitnami/wordpress +find /opt/bitnami/wordpress -type f -print0|xargs -0 chmod 644 +find /opt/bitnami/wordpress -type d -print0 |xargs -0 chmod 755 +chmod 440 /opt/bitnami/wordpress/wp-config.php + +# Configure nginx +rm /etc/nginx/sites-enabled/default +wget https://git.dfosd.synology.me/docker/ubuntu-wordpress/raw/branch/master/nginx-ssl.conf -O /etc/nginx/sites-enabled/nginx-ssl.conf