Nginx + PHP Web Platform

Source: Internet
Author: User

------------------Installing Nginx-------------------

Installing compilation tools and dependent environments

# yum Install gcc gcc-c++ make pcre-devel openssl-devel zlib-devel-y

# Useradd Nginx //create Nginx User

# TAR-XVF nginx-1.6.2.tar.gz //decompression Nginx Source Package

# CD nginx-1.6.2


#./configure \ //configure Nginx compilation parameters

>--prefix=/usr/local/nginx \ //Specify installation directory

>--user=nginx \ //designated users

>--group=nginx \ //Specify Group

>--with-http_ssl_module \ //Enable SSL module

>--with-http_gunzip_module \ //enable Gunzip module


After success, prompt as follows:

Configuration Summary

+ Using System PCRE Library

+ Using System OpenSSL Library

+ md5:using OpenSSL Library

+ sha1:using OpenSSL Library

+ Using System zlib Library


# make && make install//compile and install

Test if Nginx is available

# yum Install elinks-y //elinks is a text-mode browser

# Cd/usr/local/nginx

#./SBIN/NGINX-C/usr/local/nginx/conf/nginx.conf //Start Nginx Service

# elinks--dump http://localhost/ //access the local Web service, prompting the following information to indicate that Nginx is working properly

Welcome to nginx!


If you see this page, the Nginx Web server is successfully installed and

Working. Further configuration is required.


For online documentation and the refer to [1]nginx.org.

Commercial support was available at [2]nginx.com.


Thank for using Nginx.


-----------------Install PHP------------------

# Yum Install libxml2-devel //Installing PHP dependent libraries

# TAR-XJVF php-5.5.22.tar.bz2 //unzip PHP source package

# CD php-5.5.22

#./configure \

>--PREFIX=/USR/LOCAL/PHP-FPM \ //Specify installation directory

>--ENABLE-FPM \ //enable FPM mode

> With-mysql \ //enable MySQL support

> With-mysqli //enable support mysqli


# make && make install//compile installation

# CP SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM //Add Launch Management script

# chmod +X/ETC/INIT.D/PHP-FPM

Build configuration file

# cp/usr/local/php-fpm/etc/php-fpm.conf.default/usr/local/php-fpm/etc/php-fpm.conf

# service PHP-FPM start//start PHP-FPM mode

# PS aux | grep php-fpm //Startup success process already exists

Root 14472 0.0 0.6 40752 3356?                                                       Ss 02:42 0:00 php-fpm:master process (/usr/local/php-fpm/etc/php-fpm.conf)        Nobody 14473 0.0 0.5 40752 2984?        S 02:42 0:00 Php-fpm:pool www Nobody 14474 0.0 0.5 40752 2984? S 02:42 0:00 Php-fpm:pool www


-----------------Nginx PHP Integration-----------------

Edit Nginx configuration file

# Vim /usr/loca/nginx/conf/nginx.conf

Location/{

root HTML;

Index index.php index.html index.htm; Add index.php here

}


The following section removes the comment and modifies the Fastcgi_param 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;

}

Add a php page file to test

# cd/usr/loca/nginx/html

# vim index.php writes the following:

<?php

Phpinfo (); //Print Phpinfo function

?>


# elinks--dump http://localhost///Access test has been successful

[1] PHP logo

PHP Version 5.5.22

System Linux 6785021FBDC1 2.6.32-504.8.1.el6.x86_64 #1

SMP Wed Jan 21:11:36 UTC x86_64

Build Date Mar 16 2015 02:33:13

Configure Command './configure '--prefix=/usr/local/php-fpm '

'--enable-fpm '--with-mysql '--with-mysqli '

Server API fpm/fastcgi

Virtual Directory Disabled

Support

Configuration File/usr/local/php-fpm/lib

......


This article is from the "Supertaodi" blog, make sure to keep this source http://supertaodi.blog.51cto.com/7256234/1620778

Nginx + PHP Web Platform

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.