Simple Yum Add nginx+php support

Source: Internet
Author: User
Tags phpinfo

Simple Yum Installation Nginx+php+mysql


[Email protected] ~]# yum-y install php* mysql*


[Email protected] ~]# vim/etc/php-fpm.d/www.conf


Modify user and group to nginx users nobody


[Email protected] ~]# Vim/etc/php.ini #修改时间区


Date.timezone = asia/chongqing



Compile and install Nginx, do not need too many options,./configure--prefix=/usr/local/nginx


Modify Nginx config file, add PHP support


[Email protected] ~]# vim/usr/local/nginx/conf/nginx.conf

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; #注意, in order to avoid the problem of egg ache, please enter absolute path

Include Fastcgi_params;

}

[[Email protected] ~] #service mysqld Restart #启动Mysql


[[Email protected] ~] #service php-fpm Restart #启动php-fpm process, PHP-FPM process for dynamic parsing of PHP files


[Email protected] ~]#/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf #启动nginx进程


To see if the launch was successful:


1.

First look at the port:


[Email protected] ~]# Netstat-anptul|grep 80

TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26640/nginx


[Email protected] ~]# NETSTAT-ANPTUL|GREP 9000

TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 26656/php-fpm


To view the PHP-FPM process:

[[email protected] ~]# ps-ef|grep PHP

Root 1445 1 0 01:33? 00:00:00 Php-fpm:master Process (/etc/php-fpm.conf)

Apache 1446 1445 0 01:33? 00:00:00 Php-fpm:pool www

Apache 1447 1445 0 01:33? 00:00:00 Php-fpm:pool www

Apache 1448 1445 0 01:33? 00:00:00 Php-fpm:pool www

Apache 1449 1445 0 01:33? 00:00:00 Php-fpm:pool www

Apache 1450 1445 0 01:33? 00:00:00 Php-fpm:pool www

Root 1460 975 0 01:37 pts/0 00:00:00 grep php


2. Add phpinfo.php file to view php information of the website


[Email protected] ~]# vim/usr/local/nginx/html/phpinfo.php

<?php phpinfo ();?>


Save to exit


You can then see the native PHP details and support in the browser by entering http://ip/phpinfo.php.





This article is from the "Fate" blog, make sure to keep this source http://czybl.blog.51cto.com/4283444/1539001

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.