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.

開発用サーバーを作る on AWS(PHP7+Nginx)

Last updated at Posted at 2017-10-04

そのまんま

3分くらいでサーバーが立つ便利な世の中。
EC2起動したらsshで接続して以下コピペすればおk。
Apacheでいい人はnginxは外してくだされ。
最後の行で止まるからEnterしたったらええよ。

sudo yum update
sudo rpm -Uvh ftp://ftp.scientificlinux.org/linux/scientific/6.4/x86_64/updates/fastbugs/scl-utils-20120927-8.el6.x86_64.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo yum install -y nginx php70 php70-php-fpm php70-mbstring php70-mcrypt php70-pdo php70-xml php70-fpm
sudo sed -i -e "s#/usr/share/nginx/html;#/var/www/html;#g" /etc/nginx/nginx.conf
sudo sed -i -e "s/user = apache/user = nginx/g" /etc/php-fpm.d/www.conf
sudo sed -i -e "s/group = apache/group = nginx/g" /etc/php-fpm.d/www.conf
sudo chmod 2777 /var/www -R
sudo chown -R nginx:ec2-user /var/www/html
echo "<?php phpinfo(); ?>" >> /var/www/html/index.php
sudo chkconfig php-fpm on
sudo chkconfig nginx on
sudo service php70-php-fpm start
sudo service nginx start

アクセスしてphpinfoが表示されるか確認しませう。

おまけ

EC2を日本時間に

$ sudo mv /etc/localtime /etc/_localtime
$ sudo cp /usr/share/zoneinfo/Japan /etc/localtime

さらにおまけ

AWS SDK導入

$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require aws/aws-sdk-php

もひとつおまけ

MySQLクライアントインストール

sudo yum install mysql57 php70-mysql php70-mysqlnd

by 株式会社Arrvis

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?