How do you install an LNMP environment conveniently? I did some looking around, and I really did find a way.
- First run yum install wget // download the wget tool
- Then run wget http://www.atomicorp.com/installers/atomic // download the atomic repo
- sh ./atomic // install
- yum check-update // update
- yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b - - libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel // install development packages and files
- yum install nginx // install
- nginx service nginx start // start
- nginx chkconfig —levels 235 nginx on // set it to start at boot for runlevels 2, 3, and 5
- yum install mysql mysql-server mysql-devel // install
- mysql service mysqld start // start
- mysql chkconfig —levels 235 mysqld on mysqladmin -u root password “123456” // set a password for the root user - service mysqld restart // restart mysql
- Install php: yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy php-common php-devel php-fpm // install php and the required components so PHP supports MySQL and FastCGI mode
- service php-fpm start chkconfig —levels 235 php-fpm on Configure nginx to support php
- mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak // rename the config file to a backup file
- cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf // since the original config file has to be written by hand, you can use the default config file as the config file // modify the nginx config file to add fastcgi support
- vi /etc/nginx/nginx.conf index index.php index.html index.htm; // add index.php // uncomment the code above, and change it to the nginx default path Configure php
1
2
3
4
5
6
7location ~ \\.php$ {
root /usr/share/nginx/html;
fastcgi\_pass 127.0.0.1:9000;
fastcgi\_index index.php;
fastcgi\_param SCRIPT\_FILENAME /usr/share/nginx/html$fastcgi\_script\_name;
include fastcgi\_params;
}
// edit the php.ini file, add cgi.fix_pathinfo = 1 at the end of the file vi /etc/php.ini
Restart nginx
php-fpm service nginx restart service php-fpm restart
Create the info.php file vi /usr/share/nginx/html/info.php
<?php phpinfo(); ?>


