CENTOS7 Nginx+php+redis Environment Construction

Source: Internet
Author: User
1, Nginx Install:
Download the Nginx bundle (package) corresponding to the current system version

# wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmBuild Nginx's Yum repository# RPM-IVH nginx-release-centos-7-0.el7.ngx.noarch.rpmDownload and install Nginx# yum Install NginxStart Nginx service systemctl start nginx Configuration default configuration file under the/etc/nginx path, using this configuration has been able to properly run Nginx, if you need to customize, modify the nginx.conf and other files under it. Test enter the IP of the machine that deploys the NGINX environment in the browser address bar, if everything is OK, you should be able to see the following words. /etc/nginx/nginx.confDeleteThe comment############################################Location ~ \.php$ {root html; Fastcgi_pass127.0. 0. 1:9000;        Fastcgi_index index.php; Fastcgi_param Script_filename/usr/share/nginx/html/$fastcgi _script_name;    Include Fastcgi_params; }###########################################Service Nginx Restart

2. Redis Install:

wget http://download.redis.io/releases/redis-3.0.0.tar.gztar zxvf redis-3.0.0.tar.gzcd redis-3.0.0./configure;make;make installredis-server /etc/redis.conf

3, Php-redis Install:

"CentOS-7 - Updates - 163.com"--import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7cd /tmpwget https://github.com/nicolasff/phpredis/zipball/master -O php-redis.zipunzip php-redis.zip解压后目录是:nicolasff-phpredis-21d6614cd nicolasff-phpredis-21d6614phpize./configuremakemake install确认一下so文件已经放置到正确目录ll /usr/lib/php/modules/redis.sovi /etc/php.ini add the following content.extension=redis.so[root@localhost phpredis-phpredis-fc673f5]# ll /usr/lib64/php/modules/redis.so

4, PHP-FPM Install:

astotheby nginxyum install php-fpm

5. Start PHP-FPM Nginx

vi /etc/php-fpm.= yesphp-fpm-c /etc/php.iniservice nginx restart

6. Test Nginx and PHP

http://localhost/test.php
    
     echo phpinfo();?>

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The above describes the CENTOS7 Nginx+php+redis environment, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.