**一、寶塔面板**
**寶塔面板:**
這里我們以 ygou168.com域名為例。
ygou168.com做為商城主域名;
admin.ygou168.com做為后臺管理入口;
kefu.ygou168.com做為客服系統
store.ygou168.com做為商戶后臺
已經下載ssl證書文件(nginx)
*****
1、網站 — 設置 — 子目錄綁定:
2、網站 — 設置 — 偽靜態:
```
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
**或者:**
if (!-e $request_filename) {
rewrite ^index.php(.*)$ /index.php?s=/$1 last;
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
```
3、配置主域名 ygou168.com HTTPS 網站 — 設置 — SSL:
選擇其他證書,將下載的ssl證書文件已記事打開,粘貼到對應的框中
4、網站 — 設置 — 配置文件(增加admin.ygou168.com與kefu.ygou168.com、store.ygou168.com配置):
```
**admin.ygou168.com配置如下:**
#BINDING-admin.ygou168.com-START
server
{
listen 80;
listen 443 ssl http2;
server_name admin.ygou168.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/ygou168.com/public;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
ssl_certificate /etc/ssl/certs/admin.ygou168.com.pem;
#nginx pem
文件路徑
ssl_certificate_key /etc/ssl/certs/admin.ygou168.com.key;
#nginx key文件路徑
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
include enable-php-73.conf;
include /www/server/panel/vhost/rewrite/ygou168.com.conf;
#禁止訪問的文件或目錄
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一鍵申請SSL證書驗證目錄相關設置
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /www/wwwlogs/ygou168.com.log;
error_log /www/wwwlogs/ygou168.com.error.log;
}
#BINDING-admin.ygou168.com-END
```
其他域名配置同上(只需更改域名名稱及ssl證書信息即可)
5、網站 — 設置 — 重定向
訪問域名:選擇 ygou168.com
目標url:https://www.ygou168.com
勾選 啟用301
最后目標url:https://www.ygou168.com$request_uri
**二、TP6 設置二級域名**
設置好寶塔面板二級域名后,需要配置tp6框架二級域名綁定
在config/app.php中
~~~
// 域名綁定(自動多應用模式有效)//配置二級域名
'domain_bind' => [
'admin' => 'admin', // 二級應用域名綁定
~~~
配置后進行測試:admin.ygou168.com