• <span id="ycodp"></span>
    <span id="ycodp"><small id="ycodp"></small></span>
    1. <label id="ycodp"></label>
      <rt id="ycodp"><tr id="ycodp"><strike id="ycodp"></strike></tr></rt>
      <i id="ycodp"><strong id="ycodp"><ul id="ycodp"></ul></strong></i>
    2. 幫助中心

      這里有最新的使用文檔和教程

      < 返回

      Centos7 手動安裝nginx+php環境

      2022-11-05 13:32 作者:31IDC 閱讀量:1690 所屬分類:Linux系統

      我們以安裝nginx1.8+php7.2版本為例進行手動安裝,具體安裝流程如下:

      一、Nginx安裝:

      1、安裝相關依賴包

      yum -y install gcc gcc-c++ autoconf automake make

      yum -y install zlib zlib-devel openssl 

      yum -yinstallopenssl-devel pcre pcre-devel

      2、下載nginx安裝包,也可以到nginx官網找到你想要安裝的版本進行下載

      nginx官網下載:http://nginx.org/download/

      1)進入目錄: cd /usr/local

      2)下載文件: wget http://nginx.org/download/nginx-1.8.0.tar.gz

      3)解壓文件: tar -zxvf nginx-1.8.0.tar.gz

      4)進入解壓后目錄: cd nginx-1.8.0

      5)執行命令編譯安裝:

      . /configure 

      make && make install

      3,安裝完成之后在/usr/local文件夾下面會多出一個nginx的文件夾

      1)進入/usr/local/nginx 目錄下:

      cd /usr/local/nginx

      2)執行 ./sbin/nginx   #啟動nginx服務

      4,將nginx 加入服務項

      1)創建服務文件:

      vi /usr/lib/systemd/system/nginx.service

      寫入以下代碼:

      [Unit]

      Description=nginx - high performance web server

      Documentation=http://nginx.org/en/docs/

      After=network.target remote-fs.target nss-lookup.target

       

      [Service]

      Type=forking

      PIDFile=/usr/local/nginx/logs/nginx.pid

      ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

      ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

      ExecReload=/bin/kill -s HUP $MAINPID

      ExecStop=/bin/kill -s QUIT $MAINPID

      PrivateTmp=true

       

      [Install]

      WantedBy=multi-user.target

       

      :wq    #保存退出

      5,測試啟動服務

      systemctl start nginx.service

      6,查看是否啟動

      ps -ef | grep nginx

      7,設置開機自啟動

      systemctl enable nginx.service

      到此nginx安裝完成

       

      二、安裝PHP

      1,安裝依賴包:

      yum install -y gcc gcc-c++ libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel freetype freetype-devel

      2,進入到/usr/local目錄下,下載php安裝包:

      cd /usr/local

      wget http://tz1.php.net/distributions/php-7.2.10.tar.gz

      也可以進入到php官網去下載:http://php.net/downloads.php

      3,解壓

      tar -zxvf php-7.2.10.tar.gz

      4,進入解壓出來的php目錄

      cd php

      注:如果解壓出來的不是php目錄,可以改名,比如解壓出來的目錄為php-7.2 ,需要執行mv php-7.2 php ,修改成php

      5,編譯php:

      編譯:

      ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts -with-mcrypt=/usr/include --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --enable-ftp --enable-session --with-gettext --with-jpeg-dir --with-freetype-dir --enable-fastcgi --without-gdbm --disable-fileinfo

      6,安裝php:

      make && make install

      7,安裝完成后可以通過php -v 可看php是否安裝成功。

      8,如果php -v 無法執行,可以將php加入到環境變量:

      編輯環境變量文件: vi /etc/profile

      文件末尾加上 export PATH="/usr/local/php/bin:$PATH"

      其中"/usr/local/php/bin"為你安裝的具體路徑,保存退出后,執行以下更改即可,執行命令:

      source /etc/profile

      這個時候我們再次執行php -v 就可以看到所安裝的版本號了。

       

      到此安裝完成。

      31IDC - 12 年深耕海外 IDC 高端資源

      主站蜘蛛池模板: 久久一日本道色综合久久m| 中文字幕亚洲综合久久菠萝蜜| 久久婷婷色综合一区二区| 国产99久久亚洲综合精品| 久久99亚洲综合精品首页| 伊人久久大香线蕉综合Av| 亚洲精品第一国产综合精品| 亚洲国产欧美国产综合一区| 区三区激情福利综合中文字幕在线一区 | 91精品国产综合久久精品| 久久综合AV免费观看| 亚洲综合伊人久久大杳蕉| 久久综合香蕉久久久久久久| 天天在线天天综合网色| 六月丁香激情综合成人| 亚洲精品国产第一综合99久久 | 国内偷自视频区视频综合| 婷婷国产天堂久久综合五月| 国产成人综合亚洲亚洲国产第一页| 亚洲精品综合在线影院| 一本色道久久综合狠狠躁| 国产综合无码一区二区色蜜蜜| 久久综合琪琪狠狠天天| 亚洲狠狠爱综合影院婷婷| 伊人久久五月丁香综合中文亚洲| 国产综合精品一区二区三区| 亚洲 自拍 另类小说综合图区| 亚洲五月综合缴情婷婷| 99久久综合给久久精品| 亚洲综合AV在线在线播放| 丁香六月婷婷综合激情动漫| 国产成人综合亚洲绿色| 色悠久久久久久久综合网| 在线综合亚洲中文精品| 91精品一区二区综合在线| 亚洲国产精品成人综合色在线婷婷| 狠狠色狠狠色综合网| 麻豆狠色伊人亚洲综合网站| 91精品国产综合久久香蕉 | 久久综合久久综合九色| 亚洲精品综合一二三区在线|