nginx+php deployment

Source: Internet
Author: User

(1) Download and install Nginx

mkdir nginx-src && cd nginx-src wget http://nginx.org/download/nginx-1.7.3.tar.gz tar xzf nginx-1.7.3.tar.gz  CD nginx-1.7.3./configure--prefix=/home/cyw/tools/nginx/source make do install

Where--prefix represents the installed directory. Just like selecting the path to the installation file in window. After the installation is complete, you can see the following file structure under the source folder:

(2) Download and install PHP

wget http://cn2.php.net/distributions/php-5.4.7.tar.gztar zvxf php-5.4.7.tar.gzcd php-5.4.7./configure  -- Prefix=/home/oduyub/tools/php/source--enable-fastcgi--enable-debug--enable-fpmmakemake Install

The make step takes a relatively long time. After the installation is complete, you can see the following folder list below the folder. After the installation is complete, you can see the following file structure under the source folder:

After the installation is complete, you can see the following file directories under the source folder:

(3) Start PHP service

The use of PHP-FPM is the starting mode.

The Start command is:

> cd/sbin/>./php-fpm

After startup, perform

  Ps-ef|grep PHP

You can see the output as follows:

(4) Start Nginx Service

You need to modify the nginx.conf file before starting

        # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000        #        #location ~ \.php$ {        #    root           htm l;        #    Fastcgi_pass   127.0.0.1:9000;        #    Fastcgi_index  index.php;        #    Fastcgi_param  script_filename  html$fastcgi_script_name;        #    include        fastcgi_params;        #}

"Note" The above # needs to be removed.

Note that the root line of HTML and Fasstcgi_param in the/html need to correspond. Indicates the path that PHP is looking for

> Cd/sbin/>sudo./nginx-s reload

Input/HTTP server address: Port number/

If can appear Nginx homepage, indicating nginx installation success

(5) test whether it can be started

Write a simple php test file index.php

<?php  phpinfo () >

Enter the following link in the URL:/HTTP server address: Port number/index.php.

If the statistics page of PHP appears, it indicates that the instructions can be executed in PHP.

(5) Error List

nginx+php deployment

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.