0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6にwordpress3.8.1をインストールする

Posted at

概要

最新版のWordpressを突っ込んでみようと思い。

準備

Wordpressの起動に必要となるパッケージをインストール。
(適当に必要なものを入れてください。自分の場合下記)

$ sudo yum install php
$ sudo yum install mysql-server

$ sudo yum install php-mysql
$ sudo yum install php-mbstring

apacheは2.x系、あとリバースプロキシにnginxを使用しています。

最新のWordpressをダウンロード

ダウンロード▶︎解凍▶︎設定ファイル修正

$ cd
$ sudo wget http://ja.wordpress.org/wordpress-3.8.1-ja.zip
$ sudo unzip wordpress-3.8.1-ja.zip

$ cd wordpress
$ sudo cp -p wp-config-sample.php wp-config.php

$ sudo vim wp-config.php

// このへんを修正。お好きな名前で。
$ diff wp-config-sample.php wp-config.php
24c24
< define('DB_NAME', 'database_name_here');
---
> define('DB_NAME', ‘wordpress’);
27c27
< define('DB_USER', 'username_here');
---
> define('DB_USER', ‘XXXXXX’);
30c30
< define('DB_PASSWORD', 'password_here');
---
> define('DB_PASSWORD', ‘YYYYYYY’);

$ cd
$ sudo cp -pr wordpress /var/www/

MySQL設定

起動

$ sudo /etc/init.d/mysqld start
・・・
                                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]

初期設定

$ sudo /usr/bin/mysql_secure_installation

パスワード設定後、特に無ければ、全部Yで良い。

MySQLの設定

MySQLにrootでログイン

$ mysql -u root -p

database作成

設定ファイルに記述したデータベース名で。

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on wordpress.* to XXXXX@localhost identified by ‘YYYYYYYY’;

mysql> exit;
Bye

作成したユーザ、パスワードでMySQLにログインできればOK

$ mysql -u XXXXXX -pYYYYYY

Apacheの設定

$ sudo vim /etc/httpd/conf.d/wordpress.conf 
$ sudo cat /etc/httpd/conf.d/wordpress.conf
Alias /wordpress /var/www/wordpress

$ sudo service httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

表示確認

http://[domain]/wordpress
をブラウザで開く
スクリーンショット 2014-02-02 10.47.52.png

キターーーーーーーーーーー!!!!

ちなみに自分の場合nginxをリバースプロキシに設定しており、最初Forbiddenで弾かれてましたが、
nginxのconfファイルにエントリポイントを追加したら動きました。

/etc/nginx/conf.d/reverse_proxy.conf
server {
    listen 80;

    server_name  hoge.com;

    proxy_redirect                          off;
    proxy_set_header Host                   $host;
    proxy_set_header X-Real-IP              $remote_addr;
    proxy_set_header X-Forwarded-Host       $host;
    proxy_set_header X-Forwarded-Server     $host;
    proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;


    location / {
            proxy_pass http://127.0.0.1:8080;
    }

    location /wordpress/index.php {
            proxy_pass http://localhost/wordpress:8080;
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?