Nginx configuration, nginx
Environment Problems
Linux (centos6.6): Linux xiao-wei 2.6.32-504.16.2.el6.x86 _ 64 #1 SMP Wed Apr 22 06:48:29 UTC 2015 x86_64 x86_64 x86_64 GNU/LinuxNginx: nginx version: nginx/1.8.0
Mysql: mysql Ver 14.14 Distrib 5.6.24, for Linux (x86_64) using EditLine wrapperphp: PHP 5.6.8 (cli) (built: Apr 30 2015 00:05:13) Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
Note: Installation Process refer to the following articles http://www.nginx.cn/231.html http://www.cnblogs.com/huangzhen/archive/2012/09/12/2681861.html http://blog.linuxeye.com/342.html
I. Installation preparation: yum-y install gcc automake autoconf libtool make
Yum-y install gcc-c ++ glibc
Yum-y install kernel-devel mhash-devel libxslt-devel \ libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel \ zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel \ ncurses-devel curl-devel e2fsprogs e2fsprogs-devel \ krb5 krb5-devel libidn-devel openssl-devel
* Libmcrypt-devel mhash-devel is not installed. (This installation package is not found in the source !! _!!) Install with source code * (refer to the article http://www.cnblogs.com/huangzhen/archive/2012/09/12/2681861.html)
Download the Libmcrypt, mhash, mcrypt installation package libmcrypt(libmcrypt-2.5.8.tar.gz); mhash(mhash-0.9.9.9.tar.gz)
2. install Libmcrypt # tar-zxvf libmcrypt-2.5.8.tar.gz # cd libmcrypt-2.5.8 #./configure # make install Description: Libmcrypt is installed in/usr/local by default.
3. install mhash # tar-zxvf mhash-0.9.9.9.tar.gz # cd mhash-0.9.9.9 #./configure # make install
4. install mcrypt # tar-zxvf mcrypt-2.6.8.tar.gz # cd mcrypt-2.6.8 # LD_LIBRARY_PATH =/usr/local/lib./configure # make install
Ii. install php-fpm
Wget http://cn2.php.net/distributions/ (Note: here you need to find the corresponding server to download the corresponding version) tar zvxf php-5.6.24.tar.gzcd php-5.6.24. /configure -- prefix =/usr/local/php -- enable-fpm -- with-mcrypt \ -- enable-mbstring -- disable-pdo -- with-curl -- disable-debug -- disable-rpath \ -- enable-inline-optimization -- with-bz2 -- with-zlib -- enable-sockets \ -- enable-sysvsem -- enable-sysvshm -- enable-pcntl -- enable-mbregex \ -- with-mhash -- enable-zip -- with-pcre-regex -- with-mysql -- with-mysqli \ -- with-gd -- with-jpeg-dir
* Check for known struct flock definition... configure: error: Don't know how to define struct flock on this system, set -- enable-opcache = no error * solution: (See http://blog.linuxeye.com/342.html)
Run export LD_LIBRARY_PATH =/lib/:/usr/local/lib before configure.
Make all install
The above completes the installation of php-fpm.
Below is the php-fpm running user settings # cd/usr/local/php # cp etc/php-fpm.conf.default etc/php-fpm.conf # vi etc/php-fpm.conf modify user = www-plain roup = www- data
If the www-data user does not exist, add the www-data user # groupadd www-data # useradd-g www-data
3. Compile and install nginxThen install nginx according to the http://www.nginx.cn/install
Modify the nginx. conf file # pass the PHP scripts to FastCGI server listening on 127.0.0.1: 9000 # location ~ \. Php $ {root html; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; include fastcgi_params ;}
4. Create a PHP File
Create the index. php file in/usr/local/nginx/html and enter the following content:
<? Php echo phpinfo ();?>
5. Start the service
Start php-fpm and nginx
/Usr/local/php/sbin/php-fpm # start mode of manual patching/usr/local/php/sbin/php-fpm start
Sudo/usr/local/nginx
Vi. Test
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.