1. MySQLinstallation (sameLAMP inside the installation method)
2. PHPinstallation
wgethttp://cn2.php.net/distributions/php-5.4.37.tar.bz2
Tar jxf php-5.4.37.tar.bz2
Useradd-s/sbin/nologin PHP-FPM
CD php-5.4.37 ( If you don't want this to cover your lamp php You can define a new directory here in-prefix)
./configure--PREFIX=/USR/LOCAL/PHP2--with-config-file-path=/usr/local/php/etc--enable-fpm--with-fpm-user= PHP-FPM--with-fpm-group=php-fpm--with-mysql=/usr/local/mysql--with-mysql-sock=/tmp/mysql.sock--with-libxml-dir --WITH-GD--with-jpeg-dir--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir--with-mcrypt- -enable-soap--enable-gd-native-ttf--enable-ftp--enable-mbstring--enable-exif--disable-ipv6--with-curl
If an error occurs: checking for CURL in default path ... not found
Configure:error:Please Reinstall the Libcurl distribution-
Easy.h should be in/include/curl/
then install this yum-y Install curl-devel can be solved
Make && make install
Copy startup script:
cp/usr/local/src/php-5.4.37/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm
Mv/usr/local/php2/etc/php-fpm.conf.default/usr/local/php2/etc/php-fpm.conf
chmod 755/etc/init.d/php-fpm
Chkconfig--add PHP-FPM
Service PHP-FPM Start
Chkconfig PHP-FPM on
3 Installation of Nginx
cd/usr/local/src/
wgetHttp://nginx.org/download/nginx-1.6.2.tar.gz
Tar zxvf nginx-1.6.2.tar.gz
CD nginx-1.6.2
./configure--prefix=/usr/local/nginx--with-pcre
If this step indicates an error ./configure:error:the HTTP Rewrite module requires the PCRE library.
You can install yum-y Install pcre-devel solve the problem
Make
Make Install
start Nginx:
/usr/local/nginx/sbin/nginx
Plus-T to check if the configuration file is correct
4 Setting parsing PHP files
. Configuration parsing PHP
vim/usr/local/nginx/conf/nginx.conf//Put the following configuration, before the # Delete, and Change Fastcgi_param Script_filename the line .
Location ~ \.php$ {
root HTML;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param Script_filename/usr/local/nginx/html$fastcgi_script_name;
Include Fastcgi_params;
}
Reload/usr/local/nginx/sbin/nginx-s Reload Check the configuration file/usr/local/nginx/sbin/nginx-t Finally, you can parse PHP successfully If you want to shut down Nginx service can killall-9 Nginx
Note: If you deny access here, it is possible that the php.ini configuration file is set up Open_basdir
Test can parse PHP files normally, write a PHP file
vim/usr/local/nginx/html/1.php Increase <?php phpinfo (); ?> Then, enter http://ip/1.php in the browser to see if it can be accessed, if normal, then LNMP build successfully |
Construction of LNMP Environment