Create an Nginx + PHP + MySQL environment on AmazonAWSEC2LinuxAMI

Source: Internet
Author: User
Running Environment: AmazonLinuxAMI2012.09-release1, system update and configuration 1) update System Software $ sudo-s # yumcheck-update # reboot after yumupdate is updated, because there may be kernel updates! 2) install rzsz: # wgetftp: ftp.isu.edu. twpublinuxfedfedoralinuxrelease

Running Environment: Amazon Linux AMI 2012.09-release 1. system update and configuration 1) update System Software $ sudo-s # yum check-update # reboot after yum update is complete, because there may be kernel updates! 2) install rz/sz: # wget ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/release

Running Environment: Amazon Linux AMI 2012.09-release

1. system update and Configuration

1) Update System Software

$ sudo -s# yum check-update# yum update

Reboot after update, because there may be kernel updates!

2) install rz/sz:

# wget ftp://ftp.isu.edu.tw/pub/Linux/Fedora/linux/releases/16/Fedora/i386/os/Packages/lrzsz-0.12.20-29.fc16.i686.rpm# rpm -ivh lrzsz-0.12.20-29.fc16.i686.rpm

3) modify the time zone:

$ sudo vi /etc/sysconfig/clock ZONE="Asia/Shanghai"# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 

4) disable unnecessary auto start services:

$ sudo chkconfig iptables off$ sudo chkconfig ip6tables off# chkconfig netfs off# chkconfig lvm2-monitor off

2. Add a m swap file

1) Create and activate swap files:

# cd /var/# dd if=/dev/zero of=swapfile bs=4096 count=262144# /sbin/mkswap swapfile# /sbin/swapon swapfile

2) add it to the fstab file to enable automatic startup during system boot:

# Add the following content to the end of vi/etc/fstab:/var/swapfile swap defaults 0 0

3. Install the gcc compiler

# yum -y install gcc# yum -y install gcc-c++# yum -y install make automake

4. Install nginx

1) install the dependent libraries:

# yum -y install pcre-devel zlib-devel openssl openssl-devel

2) install nginx:

# yum install nginx

Add boot auto start:

# chkconfig --level 35 nginx on# /etc/init.d/nginx start

5. install PHP

# yum search php5# yum install php54-fpm php54-gd

Modify Configuration:

# vi /etc/php-fpm.d/www.conf;listen = 127.0.0.1:9000listen = /var/run/php-fpm/php-fpm.sockuser = nginxgroup = nginxpm.max_children = 20pm.start_servers = 3pm.min_spare_servers = 3pm.max_spare_servers = 10pm.max_requests = 5000

Create the session directory:

# cd /var/lib/php/# mkdir session# chown nginx. session

Add boot auto start:

# chkconfig --level 35 php-fpm on# /etc/init.d/php-fpm start

6. Install MySQL Server

Install MySQL 5.5:

# yum install mysql55-server php54-mysql

Add boot auto start:

# chkconfig --level 35 mysqld on# /etc/init.d/mysqld start

Original article address: Create an Nginx + PHP + MySQL environment on the Amazon AWS EC2 Linux AMI. Thank you for sharing your gratitude.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.