Centos 6.5 Deployment Enterprise website Platform nginx+php

Source: Internet
Author: User
Tags fpm phpinfo automake

First, pre-installation preparation

# yum-y Install gcc gcc-c++ glibc automake autoconf libtool make

# yum-y Install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype FreeType -devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel C URL curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel

Second, PHP-FPM installation

# wget http://mirrors.sohu.com/php/php-5.5.36.tar.bz2

# tar jxf php-5.5.36.tar.bz2

# CD php-5.5.36

#./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

# Make && make install


Configure PHP-FPM Run User

# Useradd Www-m

# cd/usr/local/php/

# CP Etc/php-fpm.default etc/php-fpm.conf

# VI Etc/php-fpm.conf

Modify
user = www
Group = www


Third, compile and install Nginx

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


1. Install the plug-in installation package

First you need to install pcre Library, then installs nginx :

#安装 pcre support rewrite library can also install the source code, note * when installing the source, specify pcre path is the path to extract the source code, not the compiled path, otherwise error

(make[1]: * * [/usr/local/pcre/makefile] Error 127 errors)

# yum-y Install pcre-devel pcre zlib zlib-devel OpenSSL openssl-devel

Or

Source Installation Pcre (Pcre supports rewrite library)

WGET  ftp://ftp.csx.cam.ac.uk/pub/software /programming/pcre/pcre-8.37.tar.bz2 ; tar jxf pcre-8.37.tar.bz2; cd  pcre-8.37 && ./configure--prefix=/usr/local/pcre && make && make install

Source Installation Zlib Library (zlib support gzip compression)

# CD/USR/LOCAL/SRC  ; wget http://zlib.net/zlib-1.2.8.tar.gz; tar zxf zlib-1.2.8.tar.gz; CD zlib-1.2.8 &&./configure--prefix=/usr/local/zlib && make && m Ake Install

Install SSL (some VPS default does not install SSL)

# CD/USR/LOCAL/SRC  ; wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz; tar zxf openssl-1.0.2d.tar.gz


2. Installing Nginx


# cd/usr/local/src; wget-c http://nginx.org/download/nginx-1.8.1.tar.gz ; tar-zxf nginx-1.8.1.tar.gz; CD nginx-1.8.1

#进入解压目录, then sed modifies the Nginx version information to WS

Sed-i-E ' s/1.8.1/g '-e ' s/nginx\//ws/g '-e ' s/"Nginx"/"WS"/g ' src/core/nginx.h

Pre-compiled Nginx

# Useradd www;. /configure--prefix=/usr/local/nginx \

--user=www \

--GROUP=WWW \

--with-http_stub_status_module \

--with-http_ssl_module \

--with-pcre=/usr/local/src/pcre-8.37 \

--with-zlib=/usr/local/src/zlib-1.2.8 \

--with-openssl=/usr/local/src/Openssl-1.0.2d

Attention:

--with-pcre=/usr/local/src/pcre-8.37 refers to the pcre-8.37 source path.

--with-zlib=/usr/local/src/zlib-1.2.8 refers to the zlib-1.2.8 source path.

#  Make && make install

Since the installation of the Nginx is complete


Iv. Modify the nginx.conf file to support PHP-FPM

# cd/usr/local/nginx/

# CP conf/nginx.conf Conf/nginx.conf.bak

# VI Conf/nginx.conf


Where the server segment adds the following configuration, note the Red content configuration, otherwise there will be no input file specified. Error

# 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;
}


V. Create a test PHP file

Under/usr/local/nginx/html, create a info.php, and enter the following:

<?php

Echo Phpinfo ();

?>

Vi. Start-up service

#/USR/LOCAL/PHP/SBIN/PHP-FPM

#/usr/local/nginx/sbin/nginx

Vii. Browser Access

In the browser access:/HTTP Server ip/info.php, if you see the following PHP information, that the environment was successfully deployed.

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/83/25/wKiom1drmGKxjAj8AACCr78e0Hk732.png-wh_500x0-wm_3 -wmp_4-s_1964081150.png "title=" Phpinfo.png "alt=" Wkiom1drmgkxjaj8aaccr78e0hk732.png-wh_50 "/>

This article is from the "Technology Life" blog, please be sure to keep this source http://gnucto.blog.51cto.com/3391516/1792219

Centos 6.5 Deployment Enterprise website Platform nginx+php

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.