解析二級域名和配置https證書
一、解析二級域名
-
1、打開騰訊雲/阿里雲
-
2、找到 雲解析 -> 域名解析列表 -> 點擊要解析域名的解析操作
-
3、點擊添加記錄
比如原來主域名爲mywebsite.com
,子域名填寫abc.mywebsite.com
-
4、
ping abc.mywebsite.com
測試是否添加子域名成功
二、配置https證書
- 1、打開騰訊雲/阿里雲
- 2、找到 ssl證書 -> 證書管理 -> 申請免費證書
- 3、通用名字可寫
abc.mywebsite.com
- 4、選中 自動DNS驗證
- 5、下載ssl證書後放到雲服務器上某個路徑
- 6、新增一個
nginx的conf
配置,如xxx.conf
配置中,開啓ssl
並指定證書的路徑// 完整配置 server { 5 listen 443 ssl; 6 server_name abc.mywebsite.com; 7 8 root /data/www/abc; 9 index index.php index.html index.htm; 10 11 access_log /var/log/nginx/access_it.log main; 12 13 ssl on; 14 ssl_certificate /abc/httpscer/Nginx/1_abc.mywebsite.com_bundle.crt; 15 ssl_certificate_key /envirsqy/httpscer/Nginx/2_abc.mywebsite.com.key; 16 ssl_session_timeout 5m; 17 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 18 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; 19 ssl_prefer_server_ciphers on; 20 21 22 location / { 23 24 try_files $uri $uri/ /index.php?$args; 25 26 if (!-e $request_filename) { 27 rewrite ^(.*)$ /index.php?s=$1 last; 28 break; 29 } 30 } 31 32 33 if (!-e $request_filename) { 34 rewrite "^/(.*)" /index.php?s=/$1 last; 35 break; 36 } 37 38 location ~ \.php$ { 39 40 fastcgi_pass 127.0.0.1:9000; 41 fastcgi_param PATH_INFO $fastcgi_path_info; 42 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 43 include fastcgi_params; 44 try_files $uri =404; 45 } 46 47 }