centos6.7系統源碼安裝Nginx+PHP+MYSQL

來源:互聯網
上載者:User

標籤:lnmp安裝 yum安裝lnmp   nginx php mysql

    環境:CentOS release 6.7 (Final)
    安裝軟體:nginx+mysql+php

    安裝工具:yum

1.安裝Nginx,由於預設的yum 基礎源沒有nginx,所以這邊要添加nginx官方源到本地

    1)地址:http://nginx.org/en/linux_packages.html下載系統對應的yum,如

         650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/75/04/wKiom1YwigCjowoCAAGzfDqU9ps118.jpg" style="width:561px;height:300px;" title="Screenshot-1.png" alt="wKiom1YwigCjowoCAAGzfDqU9ps118.jpg" border="0" height="300" hspace="0" vspace="0" width="561" />

  2.)配置yum源,

        a.vim /etc/yum.repos.d/nginx.repo並添加以下內容

          [nginx]
          name=nginx repo
          baseurl=http://nginx.org/packages/centos/6/x86_64/
          gpgcheck=0
          enabled=1       

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/75/02/wKioL1Ywi7nRsS1aAADCx7fUvoc900.jpg" style="width:520px;height:180px;" title="Screenshot-2.png" alt="wKioL1Ywi7nRsS1aAADCx7fUvoc900.jpg" border="0" height="180" hspace="0" vspace="0" width="520" />


   3.)yum安裝nginx並且驗證

     a.查看安裝的nginx資訊

           650) this.width=650;" style="width:500px;height:300px;" src="http://s3.51cto.com/wyfs02/M01/75/02/wKioL1YwjUPROKmWAATaHYGXLEY893.jpg" title="Screenshot-3.png" alt="wKioL1YwjUPROKmWAATaHYGXLEY893.jpg" border="0" height="300" hspace="0" vspace="0" width="500" />

       650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/75/02/wKioL1YwjWmgNZRlAADwkpIhIXo247.jpg" title="Screenshot-5.png" alt="wKioL1YwjWmgNZRlAADwkpIhIXo247.jpg" />

650) this.width=650;" style="width:250px;height:250px;" src="http://s3.51cto.com/wyfs02/M01/75/04/wKiom1YwjTbBy0ECAAI0-Ozbxao608.jpg" title="Screenshot-4.png" alt="wKiom1YwjTbBy0ECAAI0-Ozbxao608.jpg" border="0" height="250" hspace="0" vspace="0" width="250" />

2.安裝mysql

         yum install mysql mysql-server mysql-devel

         service mysqld start          chkconfig mysqld on //設定mysql開機啟動

         mysql_secure_installation //對mysql進行一系列的安全設定

3.安裝php

     yum  -y install php  php-cli php-mysql php-gd php-imap php-ldap

  php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap


4.安裝php-fpm 使php支援fascCGI模式

    yum install  php-tidy php-common php-devel php-fpm php-mysql

    service php-fpm start

5.配置nginx支援php

    1).修改之前備份設定檔

         cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak

         cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak

    2).修改/etc/nginx/conf.d/default.conf在在Server下增加index.php如同

     650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/75/05/wKiom1Ywj5nxJD5XAADbvFIK4as729.jpg" style="width:473px;height:229px;" title="Screenshot-6.png" alt="wKiom1Ywj5nxJD5XAADbvFIK4as729.jpg" border="0" height="229" hspace="0" vspace="0" width="473" />

    3).將根目錄的location那一欄配置取消注釋,

            650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/75/02/wKioL1YwkBejKCI1AAGp6_eWZnc554.jpg" style="float:right;width:650px;height:300px;" title="Screenshot-7.png" alt="wKioL1YwkBejKCI1AAGp6_eWZnc554.jpg" border="0" height="300" hspace="0" vspace="0" width="650" />












    4).配置php-fpm設定檔vim /etc/php-fpm.d/www.conf配置前先備份,修改user = nginx 和group = nginx預設是(user = apache,group = apache),

             650) this.width=650;" style="float:left;" src="http://s3.51cto.com/wyfs02/M01/75/05/wKiom1YwkNbSQnRtAAEbOHQtJX4841.jpg" title="Screenshot-8.png" alt="wKiom1YwkNbSQnRtAAEbOHQtJX4841.jpg" />

      5)重啟nginx和php-fpm,mysql測試效果,

               650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/75/02/wKioL1YwkYHgGj5vAAOrnr2uObU879.jpg" style="float:left;" title="Screenshot-9.png" alt="wKioL1YwkYHgGj5vAAOrnr2uObU879.jpg" />  


本文出自 “巫師網路” 部落格,請務必保留此出處http://whitehat.blog.51cto.com/3902359/1707361

centos6.7系統源碼安裝Nginx+PHP+MYSQL

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.