Wordpress

提供: ArchWiki
2016年5月26日 (木) 11:53時点におけるPetitsurume (トーク | 投稿記録)による版 (翻訳)
ナビゲーションに移動 検索に移動

関連記事

Wordpress はフリーでオープンソースのコンテンツ管理システム (CMS) です。Matt Mullenweg によって開発され2003年に初めてリリースされました。Wordpress には広大で活気に満ちたコミュニティが存在し、Wordpress CMS の外観や機能を簡単にカスタマイズできるフリーのプラグインやテーマが数万以上あります。Wordpress は GPLv2 でライセンスされています。

Wordpress の一番の特徴はその設定と管理のしやすさです。Wordpress サイトの設定には5分しかかかりません。Wordpress の管理パネルはウェブサイトのほぼ全てのことを簡単に設定することが可能です。プラグインやテーマの取得・インストールもそれに含まれます。Wordpress には手っ取り早い自動アップデートも存在します。

インストール

Wordpress を使うには PHPMySQL をインストールして設定する必要があります。詳しくは LAMP の記事を見て下さい。設定するときは、デフォルトでオフになっている PHP 拡張 で Wordpress が必要とする機能があるので注意してください。

ノート: 現在この記事ではPostgreSQL上でのWordpressの使用をサポートしていません。Wordpressは標準ではMySQL上でのみ動きます。どうしてもPostgreSQLでWordpressを利用したい場合は、このようなプラグインを使うことによって、PostgreSQLでWordpressを使用することができます。

pacman を使ってインストール

公式リポジトリから wordpressインストールしてください。

警告: pacman で Wordpress の更新を管理するのは簡単ですが、必須ではありません。Wordpress にはアップデートやテーマ、プラグインなどを管理するための機能が組み込まれています。公式の community パッケージをインストールした場合、Wordpress の管理パネルを使ってプラグインやテーマをインストールできなくなります。管理パネルを使うには、無駄に複雑なパーミッションの設定をしたり、root で FTP にログインする必要が出て来ます。パッケージをアンインストールしたときでも pacman は Wordpresss のインストールディレクトリを削除しません。これはディレクトリに手動でデータを追加していなかった場合も同じです。

手動インストール

wordpress.org を開いて Wordpress の最新版をダウンロードしてウェブサーバーのディレクトリに展開してください。ディレクトリにはパーミッションを設定して (Wordpress が使用する) FTP ユーザーがディレクトリに書き込みを行えるようにします。

cd /srv/http/whatever
wget https://wordpress.org/latest.tar.gz
tar xvzf latest.tar.gz

設定

以下に記述している設定方法は Wordpress をローカルネットワーク上で使うことを前提にしています。

ホスト設定

/etc/hosts ファイルを適切に設定してください。ローカルネットワークから Wordpress CMS にアクセスする際に重要になります。/etc/hosts ファイルは以下のように記述されている必要があります:

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       lithium.kaboodle.net    localhost lithium
::1             lithium.kaboodle.net    localhost lithium
ノート: ホストネームを使って Wordpress をインストールする場合、モバイル端末から Wordpress にアクセスするにはプロキシサーバーを使用する必要があります。そうしないとウェブサイトの見た目がおかしくなります。#見た目がおかしい (スタイルが適用されない) を参照。

apache の設定

ノート: PHP が動作するように Apache を設定する必要があります。設定方法は LAMP#PHP を見て下さい。また、mysql.so 拡張を有効にしてください。

apache が Wordpress を見つけられるように設定ファイルを作成してください。以下のファイルを作成して、お好きなテキストエディタで編集してください:

# /etc/httpd/conf/extra/httpd-wordpress.conf
Alias /wordpress "/usr/share/webapps/wordpress"
<Directory "/usr/share/webapps/wordpress">
	AllowOverride All
	Options FollowSymlinks
	Require all granted
	php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:$"
</Directory>

1行目の /wordpress はお好きなように変更してください。例えば、/myblog にするとあなたの Wordpress ウェブサイトを見るためには http://hostname/myblog を開くようになります。

また、手動でインストールした場合は、Wordpress のインストールディレクトリのパスを変更してください。php_admin_value 変数に親ディレクトリも忘れずに追加してください。

# /etc/httpd/conf/extra/httpd-wordpress.conf
Alias /myblog "/mnt/data/srv/wordpress"
<Directory "/mnt/data/srv/wordpress">
	AllowOverride All
	Options FollowSymlinks
	Require all granted
	php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:/mnt/data/srv:$"
</Directory>

次の apache の設定ファイルを編集して以下を追加してください:

# /etc/httpd/conf/httpd.conf
...
Include conf/extra/httpd-wordpress.conf
...

そして httpd (Apache) を再起動してください。

MySQL の設定

MySQL は様々なツールを使って設定をすることができますが、最も一般的な方法はコマンドラインツールを使う方法か、phpMyAdmin です。

phpMyAdmin を使う

phpMyAdmin のインストールと設定については phpMyAdmin を見て下さい。

In your web browser, navigate to your phpMyAdmin host and perform the following steps:

  1. Login to phpMyAdmin.
  2. Click "user" and then click "Add user".
  3. Give the pop up window a name and a password.
  4. Select "Create database with same name and grant all privileges".
  5. Click the "Add user" button to create the user.

Wordpress のインストール

Once you have spent a couple of hours setting up your http server, php, and mysql, it is finally time to let Wordpress have its five minutes and install itself. So let us begin.

ノート: If you have disabled the mysql.so PHP extension as recommended on the LAMP page and are using mysqli.so or pdo_mysql.so instead, you will most likely need a Wordpress plugin to use those APIs. A plugin for mysqli can be found at https://wordpress.org/plugins/mysqli/.

The Wordpress installation procedure will use the URL in the address field of your web browser as the default website URL. If you have navigated to http://localhost/wordpress, your website will be accessible from your local network, but it will be broken in appearance and function.

  1. Navigate to http://hostname/wordpress.
  2. Click the "Create a Configuration File" button.
  3. Click the "Let's go!" button.
  4. Fill in you database information created in the previous section
  5. Click "Submit".

If you installed Wordpress from the Official repository, then this setup procedure will not have the correct permissions to create the wp-config.php file used by Wordpress. You will have to do this step yourself as root using information Wordpress will provide.

A page will appear saying Wordpress can not write the wp-config.php file. Copy the text in the edit box and open /usr/share/webapps/wordpress/wp-config.php as root in your text editor. Paste the copied text into the editor and save the file.

After that, you will have to change permissions of the /usr/share/webapps/wordpress/ and all the files inside it to user http and group http by using chown so that the webserver can access it.

Finally, Click "Run the install" and Wordpress will populate the database with your information. Once complete, you will be shown "Success!" page. Click the login button to finish your installation.

Now would be a good time to access your website from all your devices to be sure your Wordpress installation is setup correctly.

使用方法

テーマのインストール

新しいテーマを探す

Wordpress には数千ものテーマが存在しています。google でテーマを検索するのは、ゴミだらけの川を歩いて渡るようなものでしょう。テーマを探すときは以下のサイトがおすすめです:

管理パネルを使ってインストール

Before installing a theme using the admin panel, you will need to setup an FTP server on your Wordpress host.

Once the FTP server is setup, login to your Wordpress installation and click "Appearance->Install Themes->Upload". From there select your zip file that contains your theme and click "Install Now". You will be presented with a box asking for FTP information, enter it and click "Proceed". If you have been following along closely, you should now have an installed theme. Activate it if you wish.

手動でインストール

Download the archive and extract into the wp-content/themes folder

# Example for a theme named "MyTheme"
cd /path/to/wordpress/root/directory
cd wp-content/themes
# get the theme archive and extract
wget http://www.example.com/MyTheme.zip
unzip MyTheme.zip
# remove the archive (optional)
rm MyTheme.zip

Be sure to follow any additional instructions as provided by the theme author.

Select your new theme from the theme chooser ("Appearance->Themes")

プラグインのインストール

The steps for installing a plugin are the same as they are for installing a theme. Just click the "Plugins" link in the left navigation bar and follow the steps. Wordpress is very easy to use.

アップデート

Every now and then when you log into wordpress there will be a notification informing you of updates. If you have correctly installed and configured an FTP client, and have the correct filesystem permissions to write in the Wordpress install path then you should be able to perform updates at the click of a button. Just follow the steps.

トラブルシューティング

見た目がおかしい (スタイルが適用されない)

Your Wordpress website will appear to have no styling to it when viewing it in a web browser (desktop or mobile) that does not have its hostnames mapped to ip addresses correctly.

This occurs because you used a url with the hostname of your server, instead of an ip address, when doing the initial setup and Wordpress has used this as the default website URL.

To fix this, you will either need to edit your /etc/hosts file or setup a proxy server. For an easy to setup proxy server, see Polipo, or if you want something with a little more configuration, see Squid.

Another option is changing a value in the database table of your Wordpress, specifically the wp_options table. The fix is to change the siteurl option to point directly to the domain name and not "localhost".

参照