Centos7 nginx+php+redis環境搭建

來源:互聯網
上載者:User
1、nginx install:
下載對應當前系統版本的nginx包(package)

# wget  http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm建立nginx的yum倉庫# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm下載並安裝nginx# yum install nginx啟動nginx服務systemctl start nginx配置預設的設定檔在 /etc/nginx 路徑下,使用該配置已經可以正確地運行nginx;如需要自訂,修改其下的 nginx.conf 等檔案即可。測試在瀏覽器地址欄中輸入部署nginx環境的機器的IP,如果一切正常,應該能看到如下字樣的內容。/etc/nginx/nginx.conf delete the comment ############################################ location ~ \.php$ {        root           html;        fastcgi_pass   127.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:

error:the GPG keys listed for the "CentOS-7 - Updates - 163.com" repository are already instarpm --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:

so asto parse the php by nginxyum install php-fpm

5、start php-fpm nginx

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

6、test nginx and php

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

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

以上就介紹了Centos7 nginx+php+redis環境搭建,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.