-
-
Save flamerecca/f4695a83ea1967400dc2673bc1ebfe88 to your computer and use it in GitHub Desktop.
在EC2,Amazon Linux AMI上面,安裝PHP-FPM、Nginx & MySQL(Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI, comment in chinese)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 更新linux、GCC、Make | |
sudo yum -y update | |
sudo yum install -y gcc make | |
# 安裝PHP-FPM(php version 5.6) 和 nginx | |
sudo yum install -y php56-fpm nginx | |
# 安裝 PHP 套件 | |
sudo yum install -y php56-devel php56-mysqlnd php56-pdo \ | |
php-pear php56-mbstring php56-cli php56-odbc \ | |
php56-imap php56-gd php56-xml php56-soap | |
# 安裝 PHP-APC | |
sudo yum install -y php-pecl-apc | |
sudo yum install -y pcre-devel | |
# 安裝MySQL | |
sudo yum -y install mysql-server mysql | |
# 設置Nginx | |
sudo nano /etc/nginx/conf.d/default.conf | |
# 設置PHP-FPM | |
sudo nano /etc/php-fpm.d/www.conf | |
# 自動重啟 Nginx、PHP-FPM、MySQL | |
sudo chkconfig nginx on | |
sudo chkconfig mysqld on | |
sudo chkconfig php-fpm on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Program: | |
# install composer in AWS EC2 | |
# History: | |
# 2016/08/23 recca First release | |
# 更新linux、GCC、Make | |
sudo yum -y update | |
echo "yum update complete!" | |
sudo yum install -y gcc | |
echo "gcc installed" | |
sudo yum install -y make | |
echo "make installed" | |
# 安裝PHP-FPM(php version 5.6) 和 nginx | |
sudo yum install -y php56-fpm | |
echo "php56-fpm installed!" | |
sudo yum install -y nginx | |
echo "nginx installed!" | |
# 安裝 PHP 套件 | |
sudo yum install -y php56-devel php56-mysqlnd php56-pdo \ | |
php-pear php56-mbstring php56-cli php56-odbc \ | |
php56-imap php56-gd php56-xml php56-soap | |
echo "php packages installed!" | |
# 安裝MySQL | |
sudo yum -y install mysql-server mysql | |
echo "mysql installed!" | |
# 自動重啟 Nginx、PHP-FPM、MySQL | |
sudo service nginx restart | |
sudo service mysqld restart | |
sudo service php-fpm restart | |
#安裝composer | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/sbin/composer | |
echo "composer installed!" | |
#安裝 yii2 | |
composer global require "fxp/composer-asset-plugin:^1.2.0" | |
composer create-project --prefer-dist yiisoft/yii2-app-basic basic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
root /var/www/html; | |
index index.php index.html index.htm; | |
} | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/ | |
html$fastcgi_script_name; | |
include fastcgi_params; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Program: | |
# install composer in AWS EC2 | |
# History: | |
# 2016/08/21 recca First release | |
# 更新linux、GCC、Make | |
sudo yum -y update | |
echo "yum update complete!" | |
sudo yum install -y gcc | |
echo "gcc installed" | |
sudo yum install -y make | |
echo "make installed" | |
# 安裝PHP-FPM(php version 5.6) 和 nginx | |
sudo yum install -y php56-fpm | |
echo "php56-fpm installed!" | |
sudo yum install -y nginx | |
echo "nginx installed!" | |
# 安裝 PHP 套件 | |
sudo yum install -y php56-devel php56-mysqlnd php56-pdo \ | |
php-pear php56-mbstring php56-cli php56-odbc \ | |
php56-imap php56-gd php56-xml php56-soap | |
echo "php packages installed!" | |
# 安裝MySQL | |
sudo yum -y install mysql-server mysql | |
echo "mysql installed!" | |
# 自動重啟 Nginx、PHP-FPM、MySQL | |
sudo service nginx restart | |
sudo service mysqld restart | |
sudo service php-fpm restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
;listen = 127.0.0.1:9000 | |
listen = /var/run/php-fpm/php-fpm.sock | |
;listen.owner = nobody | |
listen.owner = nginx | |
;listen.group = nobody | |
listen.group = nginx | |
;listen.mode = 0666 | |
listen.mode = 0664 | |
user = nginx | |
group = nginx | |
[...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment