乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Centos7 搭建lnmp環(huán)境 (centos7+nginx+MySQL5.7.9+PHP7)

       昵稱21532077 2019-12-12

      阿里云一臺服務(wù)器出現(xiàn)問題!

      我估計是一鍵安裝包環(huán)境的原因,所以打算重新搭建下環(huán)境!

      首先,當(dāng)然是先做好快照!安全第一!

      對系統(tǒng)盤做更換系統(tǒng)操作,裝上純凈版的centos。

       裝好后,進(jìn)入系統(tǒng)

      一、掛載數(shù)據(jù)盤

      df -h

      只有系統(tǒng)盤了,掛載上原來的數(shù)據(jù)盤

      fdisk -l

      看到數(shù)據(jù)盤了/dev/vdb1

      掛載上這個數(shù)據(jù)盤,

      mkdir /data0
      
      mount /dev/vdb1 /data0

      然后寫入分區(qū):

      echo '/dev/vdb1  /data0 ext4    defaults    0  0' >> /etc/fstab

      不寫入分區(qū)表,重啟后又要掛載的。

      怎么知道分區(qū)類型是ext4,用這個命令:

      df -hT

       

      好的成功了!

       

      二、安裝nginx

      首先更新系統(tǒng)軟件

      # yum update

      安裝nginx

      1.安裝nginx源

      # yum localinstall http:///packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

      2.安裝nginx

      # yum install nginx

      3.啟動nginx

      # service nginx start

      Redirecting to /bin/systemctl start  nginx.service

      4.訪問http://你的ip/

      如果成功安裝會出來nginx默認(rèn)的歡迎界面

       

      三、安裝MySQL5.7.*

      1.安裝mysql源

      # yum localinstall  http://dev./get/mysql57-community-release-el7-7.noarch.rpm

      2.安裝mysql

      # yum install mysql-community-server

      3.安裝mysql的開發(fā)包,以后會有用

      # yum install mysql-community-devel

      4.啟動mysql

      # service mysqld start

      Redirecting to /bin/systemctl start  mysqld.service

      5.查看mysql啟動狀態(tài)

      # service mysqld status

      出現(xiàn)pid

      證明啟動成功

      6.獲取mysql默認(rèn)生成的密碼

      # grep 'temporary password' /var/log/mysqld.log

       選中的就是密碼。

      7.換成自己的密碼

      # mysql -uroot -p

      Enter password:輸入上頁的密碼,進(jìn)入mysql

      8. 更換密碼

      1
      mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPasdfs4!';

      這個密碼一定要足夠復(fù)雜,不然會不讓你改,提示密碼不合法;

      9.退出mysql并試用下新密碼

      mysql> quit;
      
      mysql -uroot -p

      確認(rèn)密碼正確

      四、編譯安裝php7.0.0

      1.下載php7源碼包

      # cd /root & wget -O php7.tar.gz http://cn2./get/php-7.0.1.tar.gz/from/this/mirror

      2.解壓源碼包

      # tar -xvf php7.tar.gz

      3.進(jìn)入目錄

      # cd php-7.0.1

      4.安裝php依賴包 

      # yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

      5.編譯配置,這里如果上一步的某些依賴包沒有安裝好,就會遇到很多configure error,我們一一解決,安裝上相關(guān)軟件開發(fā)包就可以

      復(fù)制代碼
      復(fù)制代碼
      # ./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --with-fpm-user=nginx  --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared  --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir  --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets  --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache
      復(fù)制代碼
      復(fù)制代碼

      configure error:

      1.configure: error: xml2-config not found. Please check your libxml2 installation.

      解決:

      1
      <span style="color: #ff0000"># yum install libxml2 libxml2-devel</span>

       

      2.configure: error: Cannot find OpenSSL's <evp.h>

      解決:

      1
      <span style="color: #ff0000"># yum install openssl openssl-devel</span>

       

      3.configure: error: Please reinstall the BZip2 distribution

      解決:

      1
      <span style="color: #ff0000"># yum install bzip2 bzip2-devel</span>

       

      4.configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

      解決:

      1
      <span style="color: #ff0000"># yum install libcurl libcurl-devel</span>

       

      5.If configure fails try --with-webp-dir=<DIR> configure: error: jpeglib.h not found.

       

      解決:

      1
      <span style="color: #ff0000"># yum install libjpeg libjpeg-devel</span>

      6.If configure fails try --with-webp-dir=<DIR>

      checking for jpeg_read_header in -ljpeg... yes

      configure: error: png.h not found.

      解決:

      1
      <span style="color: #ff0000"># yum install libpng libpng-devel</span>

       

      7.If configure fails try --with-webp-dir=<DIR>

      checking for jpeg_read_header in -ljpeg... yes

      checking for png_write_image in -lpng... yes

      If configure fails try --with-xpm-dir=<DIR>

      configure: error: freetype-config not found.

      解決:

      1
      <span style="color: #ff0000"># yum install freetype freetype-devel</span>

      8.configure: error: Unable to locate gmp.h

      解決:

      1
      <span style="color: #ff0000"># yum install gmp gmp-devel</span>

      9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.

      解決:

        # yum install libmcrypt libmcrypt-devel

      10.configure: error: Please reinstall readline - I cannot find readline.h

      解決:

      1
      <span style="color: #ff0000"># yum install readline readline-devel</span>

      11.configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

      解決:

      1
      <span style="color: #ff0000"># yum install libxslt libxslt-devel</span>

      6.編譯與安裝

      # make && make install

      這里要make好久,要耐心一下

       7.添加 PHP 命令到環(huán)境變量

      # vim /etc/profile

      在末尾加入

      PATH=$PATH:/usr/local/php/bin

      export PATH

      要使改動立即生效執(zhí)行

      # source /etc/profile

      查看環(huán)境變量

      # echo $PATH

      查看php版本

      # php -v

      8.配置php-fpm

      # cp php.ini-production /etc/php.ini
      # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
      
      # cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
      # cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
      # chmod +x /etc/init.d/php-fpm

      9.啟動php-fpm

      # /etc/init.d/php-fpm start

      五、配置nginx虛擬機(jī),綁定域名

      # vim /etc/nginx/conf.d/php7..conf
      這里可以把php7..conf改成自己的域名

      把下面的內(nèi)容復(fù)制到php7..conf里

      復(fù)制代碼
      server{
          listen 80;
          server_name  php7.;
          root /var/www/html/php7.; # 該項要修改為你準(zhǔn)備存放相關(guān)網(wǎng)頁的路徑
          location / {
              index  index.php index.html index.htm;
               #如果請求既不是一個文件,也不是一個目錄,則執(zhí)行一下重寫規(guī)則
               if (!-e $request_filename)
               {
                  #地址作為將參數(shù)rewrite到index.php上。
                  rewrite ^/(.*)$ /index.php/$1;
                  #若是子目錄則使用下面這句,將subdir改成目錄名稱即可。
                  #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
               }
          }
          #proxy the php scripts to php-fpm
          location ~ \.php {
                  include fastcgi_params;
                  ##pathinfo支持start
                  #定義變量 $path_info ,用于存放pathinfo信息
                  set $path_info "";
                  #定義變量 $real_script_name,用于存放真實地址
                  set $real_script_name $fastcgi_script_name;
                  #如果地址與引號內(nèi)的正則表達(dá)式匹配
                  if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                          #將文件地址賦值給變量 $real_script_name
                          set $real_script_name $1;
                          #將文件地址后的參數(shù)賦值給變量 $path_info
                          set $path_info $2;
                  }
                  #配置fastcgi的一些參數(shù)
                  fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
                  fastcgi_param SCRIPT_NAME $real_script_name;
                  fastcgi_param PATH_INFO $path_info;
                  ###pathinfo支持end
              fastcgi_intercept_errors on;
              fastcgi_pass   127.0.0.1:9000;
          }
          
          location ^~ /data/runtime {
          return 404;
          }
          
          location ^~ /application {
          return 404;
          }
          
          location ^~ /simplewind {
          return 404;
          }
      }
      復(fù)制代碼

      2.重啟nginx

      # service nginx reload

      3.

      # vim /var/www/html/php7./index.php

      把下面的代碼復(fù)制到這個文件 里

      <?php

      phpinfo();

      4.查看訪問http://php7.

      ok!收工!

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多