国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Web服務器 > 正文

LNMP部署及HTTPS服務開啟教程

2024-09-01 13:56:01
字體:
來源:轉載
供稿:網友

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

                         即在Linux操作系統上Nginx+Mysql+Php的網站服務架構。

                         CentOS 6中為MySQL,CentOS 7中為Mariadb

  作用是什么    : 提供web服務,并可以解析PHP類的應用程序;

  下面我就利用LNMP架構部署phpMyAdmin:

   前提:這次操作均在172.16.75.1主機上進行;

    1.  為web服務器配置一個域名:www.sss.com

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

      172.16.75.1 www.sss.com      

    2. 在172.16.75.1主機上部署LNMP架構:

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

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

    因為Nginx只是提供web服務,不能解析PHP應用,而php-fpm可以

    而php-mysql用來連接PHP應用和Mariadb的;

    3. 配置:

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

   LNMP,HTTPS

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

  測試Nginx配置無錯,開啟服務:

[root@master ~]# systemctl start nginx

 開啟php-fpm服務:

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

 創建一個目錄用于存放資源,在nginx.conf中已經定義:

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

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

 首先部署phpMyAdmin(用來管理數據庫)應用

 解壓:

[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下創建目錄session:

  屬主為root,屬組為apache,權限為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/

給管理員配置一個數據庫的管理密碼:

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

完成后,在web端進行訪問測試:

LNMP,HTTPS


LNMP,HTTPS

這樣phpMyAdmin部署完成。

接下來為phpMyAdmin提供https服務:

[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 3653Using configuration from /etc/pki/tls/openssl.cnfCheck that the request matches the signatureSignature okCertificate 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

LNMP,HTTPS

檢測無誤后重啟nginx服務:

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

 web端測試:

LNMP,HTTPS

https服務實現。


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 龙游县| 敖汉旗| 论坛| 东安县| 怀远县| 安阳市| 荔浦县| 泌阳县| 洱源县| 翁牛特旗| 崇文区| 年辖:市辖区| 修文县| 淳安县| 温泉县| 登封市| 扎囊县| 海门市| 英德市| 商南县| 右玉县| 尚志市| 虹口区| 阜阳市| 汾阳市| 康乐县| 昌吉市| 凭祥市| 米脂县| 分宜县| 镇安县| 新龙县| 新和县| 桂阳县| 乡城县| 佳木斯市| 抚州市| 乡宁县| 柯坪县| 本溪市| 揭西县|