title: "Lnmp + Https"
date: 2019-08-28T16:18:20+08:00
draft: true
注:我的linux的ip地址為192.168.0.104
下載lnmp軟體包
wget http://soft.vpser.net/lnmp/lnmp1.6-full.tar.gz

解壓
tar -zxvf lnmp1.6-full.tar.gz
運行lnmp執行腳本
cd lnm1.6-full
./install.sh lnmp
選擇資料庫

輸入密碼,啟用MySQL InnoDB

選擇PHP

成功安裝

訪問192.168.0.104頁面

在nginx的server家目錄(默認是在/home/wwweoot/default)中添加一個index.php
<? php
phpinfo();
?>
訪問index.php,測驗nginx與php是否關聯

生成一個RSA密鑰
mkdir /usr/local/nginx/conf/cert
cd /usr/local/nginx/conf/cert
openssl genrsa -des3 -out server.key 1024
根據server.key生成證書請求
openssl req -new -key server.key -out server.csr
拷貝一個不需要輸入密碼的密鑰檔案
openssl rsa -in server.key -out server_nopass.key
自己簽約證書
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
在nginx.conf組態檔中添加ssl的基本資訊
listen 80;
root /home/wwwroot/default
server_name _;
index index.html index.php;
listen 443 ssl;
# ssl on;
ssl_certificate /usr/local/nginx/conf/cert/server.crt;
ssl_certificate_key /usr/local/nginx/conf/cert/server_nopass.key;
#error_page 403 http://www.abc.com/;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
安裝nss
yum install openssl mod_nss crypto-utils
修改nss.conf組態檔
Listen 443
VirtualHost _default_:443
NSSCertificateDatabase /etc/httpd/alias
NSSPassPhraseDialog file:/etc/httpd/nss-db-password.conf
其中 /etc/httpd/nss-db-password.conf 只包含以下一行,其中 123456是后面你為 NSS 資料庫設定的密碼
internal:123456
用apache來檢查是否加載了nss模塊
apache -M | grep nss

為 NSS 資料庫設定一個密碼
certutil -W -d /etc/httpd/alias
用 genkey 命令為 box1 創建有效期為 365 天的 NSS 兼容證書
genkey --nss --days 365 box1






列出現有的證書
certutil –L –d /etc/httpd/alias
用https來訪問服務器
注:若無法成功則reboot虛擬機


下載博客或論壇模板
https://wp.xz.cn/
https://github.com/purple910/Linux/releases
解壓
unzip Discuz_X3.2_SC_UTF8.zip
unzip wordpress-5.3.2.zip
將其主要檔案復制到nginx的root目錄下
cp -fr upload /home/wwwroot/default
cp -fr wordpress /home/wwwroot/default
安裝博客








安裝論壇


添加權限
chmod -Rf 777 /home/wwwroot/default/upload/config
chmod -Rf 777 /home/wwwroot/default/upload/data
chmod -Rf 777 /home/wwwroot/default/upload/uc_client
chmod -Rf 777 /home/wwwroot/default/upload/uc_server






轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/142313.html
標籤:Linux
下一篇:如何列印語音標, 快速輸入音標
