![]() |
◆ | 前提条件 |
Webサーバー、Webサーバー バーチャルドメイン (apache)、SQLサーバーが稼働していることが前提条件 | |
◆ | バーチャルドメイン・バーチャルホスト設定 |
バーチャルホスト openpne.papa-net.info.conf の 作成と設定 | |
※バーチャルホスト を利用しない場合は不用 | |
[root@papa-net]# vi /etc/httpd/conf.d/wordpress.papa-net.info.conf 以下新規作成 <VirtualHost *:80> DocumentRoot /home/****/wordpress ServerName wordpress.papa-net.info ErrorLog logs/wordpress.papa-net.info-error_log CustomLog logs/wordpress.papa-net.info-access_log combined env=!no_log <Directory "/home/****/wordpress"> Options ExecCGI FollowSymLinks AllowOverride All Require all granted </Directory> <IfModule alias_module> ScriptAlias /cgi-bin/ "/home/****/owordpress/cgi-bin/" </IfModule> <Directory "/home/****/wordpress/cgi-bin"> AllowOverride None Options Includes ExecCGI FollowSymLinks Require all granted </Directory> </VirtualHost> |
|
◆ | httpd ファイルの構文チェック及びバーチャルドメイン一覧表示 |
[root@papa-net]# httpd -t Syntax OK <--- Syntax OK になっていればOK [root@papa-net]# httpd -t -D DUMP_VHOSTS VirtualHost configuration: *:80 is a NameVirtualHost default server blog.papa-net.info (/etc/httpd/conf.d/blog.papa-net.info.conf:1) port 80 namevhost blog.papa-net.info (/etc/httpd/conf.d/blog.papa-net.info.conf:1) port 80 namevhost sopenpne.papa-net.info (/etc/httpd/conf.d/sopenpne.papa-net.info.conf:1) port 80 namevhost www.papa-net.info (/etc/httpd/conf.d/www.papa-net.info.conf:1) port 80 namevhost any (/etc/httpd/conf.d/virtualhost-reject.conf:1) |
|
◆ | wget のインストール |
既にインストールされている場合は不要 | |
[root@centos]# dnf -y install epel-release |
|
◆ | 開発環境 |
既にインストールされている場合は不要 | |
|
|
◆ | WordPress のダウンロード |
WordPress を WordPress のサイトよりダウンロード | |
[root@papa-net]# wget http://ja.wordpress.org/wordpress-5.7.1-ja.zip |
|
※最新版を確認(日本語版の最新版は 2021年4月現在 5.7.1) | |
ダウンロードしたファイルを解凍 | |
[root@papa-net]# unzip wordpress-5.7.1-ja.zip |
|
解凍したファイルをホームページ公開ディレクトリに移動 | |
[root@papa-net]# mv wordpress /home/****/ ( **** はHP公開ディレクトリ) |
|
ダウンロードした不要なファイルを削除 | |
[root@papa-net]# rm -rf wordpress-5.7.1-ja.zip |
|
WordPressの所有者(実行権限者)を apache に変更 | |
[root@papa-net]# chown -R apache:apache /home/****/wordpress ( **** はHP公開ディレクトリ) |
|
◆ | WordPress用のSQLサーバーデータベースの管理ユーザ作成 |
[root@papa-net# mysql -u root -p****** (****** はパスワード) Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 98 Server version: 10.3.27-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database wordpress; <--- 入力(データベース wordpress の作成) Query OK, 1 rows affected (0.00 sec) MariaDB [(none)]> grant all privileges on wordpress.* to xxxx@localhost identified by '******'; Query OK, 0 rows affected (0.00 sec) ↑ 入力(xxxx はユーザー名・****** はパスワード) MariaDB [(none)]> exit <--- 入力 Bye |
|
◆ | WordPressの設定 |
設定ファイルをサンプルよりコピー | |
[root@papa-net]# cp /home/****/wordpress/wp-config-sample.php /home/****/wordpress/wp-config.php |
|
設定ファイルの設定 | |
[root@papa-net]# vi /home/****/wordpress/wp-config.php ( **** はHP公開ディレクトリ) 途中略 // ** MySQL 設定 - こちらの情報はホスティング先から入手してください。 ** // /** WordPress のためのデータベース名 */ define('DB_NAME', 'database_name_here'); <--- 書き換え(上記で作成した データベース名) ↓ define('DB_NAME', 'wordpress'); /** MySQL データベースのユーザー名 */ define('DB_USER', 'username_here'); <--- 書き換え(上記で作成した ユーザー名) ↓ define('DB_USER', 'xxxx'); /** MySQL データベースのパスワード */ define('DB_PASSWORD', 'password_here'); <--- 書き換え(上記で作成したパスワード) ↓ define('DB_PASSWORD', '******'); 途中略 /**#@+ * 認証用ユニークキー * * それぞれを異なるユニーク (一意) な文字列に変更してください。 * {@link https://api.wordpress.org/secret-key/1.1/ WordPress.org の秘密鍵サービス} * で自動生成することもできます。 * 後でいつでも変更して、既存のすべての cookie を無効にできます。これにより、 * すべてのユーザーを強制的に再ログインさせることができます。 * * @since 2.6.0 */ define('AUTH_KEY', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('AUTH_KEY', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('SECURE_AUTH_KEY', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('LOGGED_IN_KEY', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('LOGGED_IN_KEY', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('NONCE_KEY', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('NONCE_KEY', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('AUTH_SALT', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('AUTH_SALT', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('SECURE_AUTH_SALT', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('LOGGED_IN_SALT', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('LOGGED_IN_SALT', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); define('NONCE_KEY', 'put your unique phrase here'); <--- 書き換え(適当なフレーズ) ↓ define('NONCE_KEY', 'kjlhuipyuhnuty87yuyt8i6rg67ruyj'); /**#@-*/ 以下略 |
|
WordPress をアップロードしたディレクトリのアクセス権を書き込み可能(777)に変更 | |
[root@papa-net]# chmod 777 /home/****/wordpress ( **** はHP公開ディレクトリ) |
|
◆ | PHP・Apache の設定 |
PHP コードがそのまま表示されてしまう事への対策 | |
[root@fedora]# vi /etc/php.ini 途中略 ;;;;;;;;;;;;;;;;;;;; ; Language Options ; ;;;;;;;;;;;;;;;;;;;; ; Enable the PHP scripting language engine under Apache. ; http://php.net/engine engine = On ; This directive determines whether or not PHP will recognize code between ; <? and ?> tags as PHP source which should be processed as such. It's been ; recommended for several years that you not use the short tag "short cut" and ; instead to use the full <?php and ?> tag combination. With the wide spread use ; of XML and use of these tags by other languages, the server can become easily ; confused and end up parsing the wrong code in the wrong context. But because ; this short cut has been a feature for such a long time, it's currently still ; supported for backwards compatibility, but we recommend you don't use them. ; Default Value: On ; Development Value: Off ; Production Value: Off ; http://php.net/short-open-tag short_open_tag = Off <--- 書き換え(PHPコードがそのまま表示されてしまう事への対策) ↓ short_open_tag = on 以下略 |
|
◆ | WordPress にログイン |
クライアントPCのインターネットブラウザを開き WordPress をアップロードしたディレクトリにアクセス |
|
『サイト名』・『ユーザー名』・『パスワード』・『メールアドレス』を入力して『WordPress をインストール』をクリック | |
|
|
『ログイン』をクリック | |
|
|
『ユーザー名』 ・ 『パスワード』を入力して『ログイン』をクリック | |
|
|
管理画面が開くので必要に応じて設定 | |
|
|
画面左上の『サイトのタイトル』をクリックして通常画面の表示 | |
◆ | WordPress Importer のインストール |
インポート・エクスポートを実行するためのプラグインをインストール | |
[root@papa-net]# wget http://downloads.wordpress.org/plugin/wordpress-importer.0.7.zip |
|
※2021年4月現在最新プラグイン | |
ダウンロードしたファイルを解凍 | |
[root@papa-net]# unzip wordpress-importer.0.7.zip |
|
解凍したファイルを WordPress のプラグインディレクトリに移動 | |
[root@papa-net]# mv wordpress-importer /home/****/wordpress/wp-content/plugins/ |
|
※ **** はHP公開ディレクトリ | |
ダウンロードした不要なファイルを削除 | |
[root@papa-net# rm -rf wordpress-importer.0.7.zip |
|
◆ | インポートデータの容量制限の変更 |
wordpress の再構築等で以前のバックアップデータをインポートする場合は最高2MBまでのバックアップデータしかインポートできないので php.ini を変更 |
|
[root@papa-net]# vi /etc/php.ini 途中略 ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ;upload_tmp_dir = ; Maximum allowed size for uploaded files. upload_max_filesize = 2M <--- 書き換え (適当なサイズに変更) ↓ upload_max_filesize = 10M 以下略 |
|
設定を反映させるように Apache を再起動 | |
[root@papa-net]# systemctl restart httpd |
|
これでインポートができるようになる | |