主頁 > 知識(shí)庫 > LNMP部署及HTTPS服務(wù)開啟教程

LNMP部署及HTTPS服務(wù)開啟教程

熱門標(biāo)簽:西柏坡地圖標(biāo)注 400電話申請(qǐng)要什么條件 話術(shù)外呼系統(tǒng) i智能電話機(jī)器人yeta 燃?xì)夤芫€地圖標(biāo)注顏色 寧波400電話辦理對(duì)企業(yè)的意義 北京人工外呼系統(tǒng)廠家 廣東如何申請(qǐng)400電話 哈爾濱400電話去哪辦理

LNMP是什么 : Linux+Nginx+Mysql+(php-fpm,php-mysql)

                         即在Linux操作系統(tǒng)上Nginx+Mysql+Php的網(wǎng)站服務(wù)架構(gòu)。

                         CentOS 6中為MySQL,CentOS 7中為Mariadb

  作用是什么    : 提供web服務(wù),并可以解析PHP類的應(yīng)用程序;

  下面我就利用LNMP架構(gòu)部署phpMyAdmin:

   前提:這次操作均在172.16.75.1主機(jī)上進(jìn)行;

    1.  為web服務(wù)器配置一個(gè)域名:www.sss.com

      在物理機(jī)的C盤下的windows/System32/drivers/etc/etc/hosts文件中添加一條記錄:

      172.16.75.1 www.sss.com     

    2. 在172.16.75.1主機(jī)上部署LNMP架構(gòu):

[root@master ~]# yum install nginx mariadb php-fpm php-mysql

    在這估計(jì)大家會(huì)提出疑問,php-fpm,php-mysql的作用是什么呢?

    因?yàn)镹ginx只是提供web服務(wù),不能解析PHP應(yīng)用,而php-fpm可以

    而php-mysql用來連接PHP應(yīng)用和Mariadb的;

    3. 配置:

[root@master ~]# vim /etc/nginx/nginx.conf

  

[root@master ]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successfu

  測(cè)試Nginx配置無錯(cuò),開啟服務(wù):

[root@master ~]# systemctl start nginx

 開啟php-fpm服務(wù):

[root@master ~]# systemctl start php-fpm

 創(chuàng)建一個(gè)目錄用于存放資源,在nginx.conf中已經(jīng)定義:

[root@master ~]# mkdir -pv /myweb/nginx/

 我事先已將wordpress和phpMyAdmin的包放到該目錄下:

 首先部署phpMyAdmin(用來管理數(shù)據(jù)庫)應(yīng)用

 解壓:

[root@master ~]# cd /myweb/nginx/
[root@master nginx]# tar -xf phpMyAdmin-3.5.4-all-languages.tar.gz 
[root@master nginx]# mv phpMyAdmin-3.5.4-all-languages pma

在/var/lib/php下創(chuàng)建目錄session:

  屬主為root,屬組為apache,權(quán)限為770;

[root@master ~]# cd /var/lib/php
[root@master php]# mkdir session
[root@master php]# chown root:apache session/
[root@master php]# chmod 770 session/

給管理員配置一個(gè)數(shù)據(jù)庫的管理密碼:

[root@master ~]# mysqladmin -p'' password '111111'
Enter password:

完成后,在web端進(jìn)行訪問測(cè)試:


這樣phpMyAdmin部署完成。

接下來為phpMyAdmin提供https服務(wù):

[root@master ~]# cd /etc/pki/CA/
[root@master CA]# (umask 077;openssl genrsa -out private/cakey.pem 2048)
[root@master CA]# openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3653
[root@master CA]# touch index.txt
[root@master CA]# echo 01 > serial
[root@master ssl]# (umask 077;openssl genrsa -out nginx.key 2048)
[root@master ssl]# openssl req -new -key nginx.key -out nginx.csr -days 3653
[root@master ssl]# openssl ca -in nginx.csr -out /etc/pki/CA/certs/nginx.crt -days 3653
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
  Serial Number: 1 (0x1)
  Validity
   Not Before: Nov 12 14:15:57 2018 GMT
   Not After : Nov 12 14:15:57 2028 GMT
  Subject:
   countryName    = CN
   stateOrProvinceName  = Hebei
   organizationName   = james
   organizationalUnitName = james.edu
   commonName    = www.james.com
  X509v3 extensions:
   X509v3 Basic Constraints: 
    CA:FALSE
   Netscape Comment: 
    OpenSSL Generated Certificate
   X509v3 Subject Key Identifier: 
    5A:68:D6:47:29:DA:A5:29:98:09:0D:82:02:2D:B1:5D:61:8A:26:EC
   X509v3 Authority Key Identifier: 
    keyid:32:B2:8D:AC:68:57:FC:BF:8B:F2:CA:68:8B:45:93:D4:7F:A2:25:F3
    
  
[root@master ssl]# scp /etc/pki/CA/certs/nginx.crt ./
[root@master ssl]# rm -f nginx.csr

修改nginx配置文件:

[root@master ssl]# vim /etc/nginx/nginx.conf

檢測(cè)無誤后重啟nginx服務(wù):

[root@master ssl]# nginx -t
[root@master ssl]# nginx -s reload

 web端測(cè)試:

https服務(wù)實(shí)現(xiàn)。

標(biāo)簽:襄陽 阜陽 巴中 珠海 開封 張家口 湘潭 西藏

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《LNMP部署及HTTPS服務(wù)開啟教程》,本文關(guān)鍵詞  LNMP,部署,及,HTTPS,服務(wù),開啟,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《LNMP部署及HTTPS服務(wù)開啟教程》相關(guān)的同類信息!
  • 本頁收集關(guān)于LNMP部署及HTTPS服務(wù)開啟教程的相關(guān)信息資訊供網(wǎng)民參考!
  • 企业400电话

    智能AI客服机器人
    15000

    在线订购

    合计11份范本:公司章程+合伙协议+出资协议+合作协议+股权转让协议+增资扩股协议+股权激励+股东会决议+董事会决议

    推薦文章