3
3

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.

AWS Cloud9 × Wordpress

Last updated at Posted at 2019-05-04

Cloud9 × S3 × Wordpress × StaticPressでできるだけ費用抑えたいと思い実施
サーバーをGCEの無料版にするとS3の数10円 ? くらいで済みそうだけど少し時間掛かりそうだったのでEC2の方

Cloud9作成

  • 東京リージョン
  • Create a new instance for environment (EC2)
  • t2.micro (1 GiB RAM + 1 vCPU)
  • After 30 minutes (Default)

awsコンソールからElastic IP紐付け

  • EC2を選択
  • Elastic IP > 新しいアドレスの割り当て
  • 対象のIPチェック
  • アクション > アドレスの関連付け

セキュリティグループ設定

  • セキュリティグループ
  • 対象のグループチェック
  • インバウンド > 編集
    カスタムTCP 8080 0.0.0.0/0

wordpressセットアップ

wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
sudo service mysqld start

mysql -u root -e "CREATE DATABASE wordpress;"

awk '{ sub(/database_name_here/, "wordpress"); sub(/username_here/, "root"); sub(/password_here/, ""); print }' wordpress/wp-config-sample.php > wordpress/wp-config.php

sudo sed -ie '151d' /etc/httpd/conf/httpd.conf
sudo sed -ie '151i \    AllowOverride All' /etc/httpd/conf/httpd.conf

sudo sed -ie '131d' /etc/httpd/conf/httpd.conf
sudo sed -ie '131i <Directory "/home/ec2-user/environment">' /etc/httpd/conf/httpd.conf

sudo chown -R apache /var/www
sudo chgrp -R apache /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;
sudo service httpd restart

サーバー起動

Run > Run With > PHP (built-in web server)
http://0.0.0.0:8080/wordpress
以降Runで起動

参考URL

https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/security-group-rules-reference.html
https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/hosting-wordpress.html
https://blog.simmon.design/aws-cloud9-tutorial-new-instance/

雑感

AWSのサービスになってから少し面倒になってた。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?