Deployment of NGINX+PHP5 under Ubuntu

Source: Internet
Author: User
Tags fpm

The deployment of the NGINX+PHP5 environment under Ubuntu and the deployment of the CentOS system are slightly different, nonsense said, The following is the operation Record:
1) nginx Installation
[email protected]:~# sudo apt-get update && sudo apt-get upgrade
[email protected]:~# sudo apt-get install libpcre3 libpcre3-dev zlib1g-dev libssl-dev build-essential OpenSSL libssl0.9.8 libssl-dev
[ email protected]:~# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[email protected]:~# TAR-ZXVF nginx-1.8.0.tar.gz
[email protected]:~# cd nginx-1.8.0
[email protected]:~#./configure--prefix=/ Usr/local/nginx--user=nginx--group=nginx--with-http_ssl_module--with-http_flv_module--with-http_stub_status_ Module--with-http_gzip_static_module--with-pcre
[email protected]:~# make && make install

2) installation of PHP5
Add-apt-repository command is the addition of apt source, PPA is the source of the software, can be found on the official web
[email protected]:~# sudo add-apt-repository ppa:ondrej/php5-5.6

If the above command executes an error and no Discovery command executes
[email protected]:~# sudo apt-get install python-software-properties
[email protected]:~# sudo apt-get update
[email protected]:~# sudo apt-get install PHP
[email protected]:~# Php5-v

After the installation of php, in the Nginx add docking php configuration, access to the. PHP file will error 502!
This is because Nginx access to the. PHP file requests are given to the PHP-FPM program processing, PHP-FPM Monitoring 9000 port
So there is also the start php-fpm Program.

Installing PHP-FPM
[email protected]:~# apt-get Install php5-fpm php5-gd php5-cli php5-curl php5-mcrypt php5-mysql php5-readline

Start PHP-FPM
[email protected]:~# Service PHP5-FPM start
[email protected]:~# Ps-ef|grep php5-fpm
[email protected]:~# lsof-i:9000

however, after discovering that PHP5-FPM started, 9000 ports did not get up! Why is this?
This is because PHP-FPM has two ways of Listening: one is. sock file mode, and the other is a 9000 port method
Modification Method:
Roo[email protected]:~# vim/etc/php5/fpm/pool.d/www.conf
.....
; listen =/var/run/php5-fpm.sock //comment This line, this is the default way to listen
Listen = 9000 //change to listen on 9000 port mode

Restart PHP-FPM
[email protected]:~# Service PHP5-FPM restart
[email protected]:~# lsof-i:9000 //discovery Port 9000 is up.

Deployment of NGINX+PHP5 under Ubuntu

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.