LoginSignup
4
4

More than 5 years have passed since last update.

WordpressブログをAWSへ展開する

Last updated at Posted at 2015-10-11

【手順】
1) LAMP環境構築
2) AWSへWordpressを展開する
3) DNS設定
4) 注意点

【詳細】
1) LAMP環境構築
https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/install-LAMP.html
※下記は自分が使ったinstallコマンド(opcache, mbstring等モジュールを入れます)

#sudo yum install -y httpd24 mysql55-server php56 php56-pdo  php56-mysqlnd php56-mbstring php56-opcache php56-gd

2) AWSへWordpressを展開する
https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/hosting-wordpress.html

3) DNS設定
・Route 53を使用して、お名前といったドメイン会社からAWSのサーバーへルートする
※Todo: 詳しくまとめる

・サブドメインhttp://www.example.comhttp://example.comへリダイレクトする方法
S3とRoute 53を使って、wwwからnon-wwwへリダイレクトする
①S3に “www.example.com” 空のbucketを作成する
② ①で作成されたbucketを選択し、“プロパティ”を選び、
「静的ウェブサイトホスティング」→「別のホスト名にすべてのリクエストをリダイレクトする」
→non-wwwのURL(example.com)を入力する→「保存」する
③ Route 53から「Create new recordset」で下記の設定しに従い、

Name: www.example.com
Type: "A-IPv4 Address"
Alias: Yes
Target: 上記のS3のbucketへポイントする

www.example.comのリクエストをexample.comへルートする新しいRecordsetを作成する。

④ 反映されるまで、しばらく待つ(これ、大事w)

4) 注意点
・ブログを投稿する時、写真が自動的にリサイズされない問題
(リサイズの写真が作成されない問題)
→php-gdが必要ということで、php-gdをインストールする
#sudo yum install php-gd
#sudo service httpd restart
(PHPバージョンによって、php-gdでなく、php56-gdとかphp55-gdになります)

・HTTP Responseに不要ヘッダーをクライアントへ送らないように設定する
serverのバージョン情報非表示:httpd.confファイルへ下記の2行を追加する

ServerTokens ProductOnly
ServerSignature Off

PHPバージョン情報非表示:php.iniへ下記の行を変更する

expose_php = off

・Wordpressのセキュリティ強化
http://codex.wordpress.org/Hardening_WordPress#Resources
(日本語版:http://wpdocs.osdn.jp/Hardening_WordPress)

4
4
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
4
4