寄稿しました。
- 管理ドメイン
admin.example.local - 公開ドメイン
www.example.cocal
LAMP構築
# yum install httpd mariadb mariadb-server httpd-devel php php-mysql wget unzip rsync # systemctl start mariadb # systemctl enable mariadb # systemctl start httpd # systemctl enable httpd # firewall-cmd --permanent --zone public --add-service http # firewall-cmd --reload # mysql -u root MariaDB [(none)]> CREATE DATABASE wpdb; MariaDB [(none)]> GRANT ALL PRIVILEGES ON wpdb.* TO "wpdbuser"@"localhost" IDENTIFIED BY 'wpdbpassword'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit Bye
管理ドメインディレクトリの作成
# mkdir -p /var/www/vhosts # cd /var/www/vhosts # wget https://ja.wordpress.org/wordpress-4.8.2-ja.zip # unzip wordpress-4.8.2-ja.zip # mv wordpress admin.example.local # cp /var/www/vhosts/admin.example.local/wp-config-sample.php /var/www/vhosts/admin.example.local/wp-config.php
# vi /var/www/vhosts/admin.example.local/wp-config.php define('DB_NAME', 'wpdb'); /** MySQL データベースのユーザー名 */ define('DB_USER', 'wpdbuser'); /** MySQL データベースのパスワード */ define('DB_PASSWORD', 'wpdbpassword'); /** MySQL のホスト名 */ define('DB_HOST', 'localhost');
# mkdir -p /var/www/vhosts/www.example.local 公開ドメイン側にデータをコピー # rsync -arv /var/www/vhosts/admin.example.local/wp-content/ /var/www/vhosts/www.example.local/wp-content/ 公開ディレクトリにindex.phpを置く # cp -arv /var/www/vhosts/admin.example.local/index.php /var/www/vhosts/www.example.local/index.php
# vi /var/www/vhosts/www.example.local/index.php <?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ //require( dirname( __FILE__ ) . '/wp-blog-header.php' ); require( '/var/www/vhosts/admin.example.local/wp-blog-header.php' );
ディレクトリの作成
# mkdir -p /var/www/vhosts/www.example.local/images
権限の設定
# chown apache:apache -R /var/www/vhosts
# vi /etc/httpd/conf.d/vhost.conf NameVirtualHost *:80 <VirtualHost *:80> ServerName admin.example.local DocumentRoot /var/www/vhosts/admin.example.local LogLevel warn ErrorLog logs/error_log CustomLog logs/access_log combined <Directory /> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost> <VirtualHost *:80> ServerName www.example.local DocumentRoot /var/www/vhosts/www.example.local LogLevel warn ErrorLog logs/error_log CustomLog logs/access_log combined <Directory /> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost>
# systemctl restart httpd
http://admin.example.local/wp-admin/install.php
もくじ
サーバもわける場合
ALBを利用すれば良い