Linux build php5 Nginx

Source: Internet
Author: User
Tags openssl library
1 PHP Configuration:

First, we need to download the installation php5

cd/usr/local/src/

wget Http://cn2.php.net/get/php-5.5.33.tar.bz2/from/this/mirror

Official website http://php.net/downloads.php



Be sure to install gd,png,curl,xml and so on before installing the Lib Development library. If you are unsure, execute the following command:
Yum install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel-y
The following parameters support, FTP, image functions, PDO and other support, because the use of PHP's own mysqlnd, so there is no need to install the MySQL Lib library. If you are a 64-bit system, the parameters are appended with –with-libdir=lib64, if not can be skipped.
TAR-XJF php-5.5.0.tar.bz2
CD php-5.5.0
./configure--prefix=/usr/local/php-5.5.0--with-config-file-path=/usr/local/php-5.5.0/etc--with-bz2--with-curl- -enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local--with-png-dir=/usr/local-- With-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local--enable-mbstring-- Enable-calendar--with-gettext--with-libxml-dir=/usr/local--with-zlib--with-pdo-mysql=mysqlnd--with-mysqli= Mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64
Make
Make install
Note: If PHP does not require the support of curl and FTP, the above –with-curl–enable-ftp can be removed. If you are a professional Linux practitioner, you can completely look at Help to choose your installation parameters, if you are not, I suggest you directly copy the paste my configuration parameters. This way you can take a few detours.
Already installed PHP, below we are for PHP, configure PHP
CP Php.ini-production/usr/local/php-5.5.0/etc/php.ini
Cp/usr/local/php-5.5.0/etc/php-fpm.conf.default/usr/local/php-5.5.0/etc/php-fpm.conf
In fact, we just use it to provide us with a configuration, of course, you can also modify the configuration information according to their own needs, and then start PHP-FPM
/usr/local/php-5.5.0/sbin/php-fpm
Execute the above command, if no error is normally said to start normal, if not at ease, can also be judged by the port is php no boot
# NETSTAT-LNT | grep 9000

TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN

2 Nginx Configuration

Http://nginx.org/en/download.html

Download wget http://nginx.org/download/nginx-1.6.3.tar.gz

CD nginx-1.6.3

./configure--prefix=/usr/local/nginx-1.6.3--with-http_ssl_module--with-http_spdy_module--with-http_stub_status _module--with-pcre

Make

Make install

Let everyone understand the introduction of the configuration file
–with-http_stub_status_module: Support nginx status Query
–with-http_ssl_module: Support HTTPS
–with-http_spdy_module: Support Google's spdy, want to know please Baidu Spdy, this must have SSL support
–with-pcre: In order to support the rewrite rewrite function, it is necessary to develop pcre
The final output is as follows, indicating configure OK.
Checking for zlib library ... found
Creating Objs/makefile
Configuration Summary
+ Using System PCRE Library
+ Using System OpenSSL Library
+ md5:using OpenSSL Library
+ sha1:using OpenSSL Library
+ Using System zlib Library
Nginx path prefix: "/usr/local/nginx-1.5.1"
Nginx binary file: "/usr/local/nginx-1.5.1/sbin/nginx"
Nginx configuration prefix: "/usr/local/nginx-1.5.1/conf"
Nginx configuration file: "/usr/local/nginx-1.5.1/conf/nginx.conf"
Nginx pid file: "/usr/local/nginx-1.5.1/logs/nginx.pid"
Nginx error log file: "/usr/local/nginx-1.5.1/logs/error.log"
Nginx HTTP access log file: "/usr/local/nginx-1.5.1/logs/access.log"
Nginx HTTP client request body Temporary files: "Client_body_temp"
Nginx HTTP proxy temporary files: "Proxy_temp"
Nginx http fastcgi temporary files: "Fastcgi_temp"
Nginx http Uwsgi temporary files: "Uwsgi_temp"
Nginx http scgi temporary files: "Scgi_temp"
# make//To make sure your server has setup, do yum install if not installed
# make Install
Well, Nginx installation is very simple, of course, there is not too much to introduce about Nginx encountered problems. Because the problem may be the type will be very much, we can according to the specific error of the content of the prompt, direct Google or Baidu a bit can be. Let's talk about Nginx's startup, shutdown, and reset Nginx content.
Start: Directly execute the following command, Nginx started, do not need to change any configuration files, nginx configuration multi-domain virtual host please refer to the following articles.
/usr/local/nginx-1.5.1/sbin/nginx
Let's test if our nginx is ready to launch successfully.
[Root@ns conf]# curl-s http://localhost | grep nginx.com
Nginx.com.
Next talk about how to get the Nginx service off, we can do this in the following way
/usr/local/nginx-1.5.1/sbin/nginx-s stop
New Window
Of course, in our nginx operation, you may need to modify the Nginx configuration, you can reset the load configuration information
/usr/local/nginx-1.5.1/sbin/nginx-s Reload

The above describes the Linux build php5 Nginx, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.