1, 就是说你拿到域名, 先怀米批量绑定
2, 域名贴进mk.php , 运行 php mk.php
3, 重启服务器。
以上是http域名可访问, 才能生成秘钥不报错。
4, 批量执行 生成秘钥命令。
acme.sh --issue -d huchic.com -w /www/wwwroot/shoes/
5, 域名批量贴入mk2.php
6, php mk2.php 运行生成nginx文件。
7, 重启nginx, 大工告成。
1,
mk.php 内容
<?php
// http可访问的源文件
$source='./http.test';
// 批量要 修改的域名
$arr = [
'glcia.com',
'gdhawk.com',
'gtminde.com',
'gpchic.com',
'gpminde.com',
'huchic.com',
'gncia.com',
'gwhawk.com',
];
// 修改其内容
foreach ($arr as $v) {
fopen("./".$v.".conf", "w");
$content = file_get_contents($source);
$c1 = str_replace("inserre.com", $v, $content);
file_put_contents("./".$v.".conf", $c1);
}
http.test 内容
server
{
listen 80;
server_name inserre.com www.inserre.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/shoes;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#禁止访问的文件或目录
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 /dev/null;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log off;
}
access_log /www/wwwlogs/inserre.com.log;
error_log /www/wwwlogs/inserre.com.error.log;
}
mk2.php 内容
<?php
// 有秘钥,可直接https访问的域名
$source='./bqdrone.com.conf';
// 批量域名
$arr = [
'glcia.com',
'gdhawk.com',
'gtminde.com',
'gpchic.com',
'gpminde.com',
'huchic.com',
'gncia.com',
'gwhawk.com',
];
// 批量生成文件
foreach ($arr as $v) {
fopen("./".$v.".conf", "w");
$content = file_get_contents($source);
$c1 = str_replace("bqdrone.com", $v, $content);
file_put_contents("./".$v.".conf", $c1);
}
bqdrone.com.conf内容
server
{
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen [::]:80;
server_name bqdrone.com www.bqdrone.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/shoes;
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#SSL-END
ssl_certificate /root/.acme.sh/bqdrone.com/bqdrone.com.cer;
ssl_certificate_key /root/.acme.sh/bqdrone.com/bqdrone.com.key;
ssl_protocols 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;
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
location / {
#—————————Zen-Cart Rewrite Start———————
# From Ultimate SEO URLs
rewrite "^(.*)-p-(.*).html" /index.php?main_page=product_info&products_id=$2&% last;
rewrite "^(.*)-c-(.*).html" /index.php?main_page=index&cPath=$2&% last;
rewrite "^(.*)-m-([0-9]+).html" /index.php?main_page=index&manufacturers_id=$2&% last;
rewrite "^(.*)-pi-([0-9]+).html" /index.php?main_page=popup_image&pID=$2&% last;
rewrite "^(.*)-pr-([0-9]+).html" /index.php?main_page=product_reviews&products_id=$2&% last;
rewrite "^(.*)-pri-([0-9]+).html" /index.php?main_page=product_reviews_info&products_id=$2&% last;
# For Open Operations Info Manager
rewrite "^(.*)-i-([0-9]+).html" /index.php?main_page=info_manager&pages_id=$2&% last;
# For dreamscape’s News & Articles Manager
rewrite "^news/?" /index.php?main_page=news&% last;
rewrite "^news/rss.xml" /index.php?main_page=news_rss&% last;
rewrite "^news/archive/?" /index.php?main_page=news_archive&% last;
rewrite "^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html" /index.php?main_page=news&date=$1-$2-$3&% last;
rewrite "^news/archive/([0-9]{4})-([0-9]{2}).html" /index.php?main_page=news_archive&date=$1-$2&% last;
rewrite "^news/(.*)-a-([0-9]+)-comments.html" /index.php?main_page=news_comments&article_id=$2&% last;
rewrite "^news/(.*)-a-([0-9]+).html" /index.php?main_page=news_article&article_id=$2&% last;
rewrite "^/(.*)-c-([0-9_]+)/" /index.php?main_page=index&cPath=$2&$args last;
rewrite "^/(.*)-ezp-([0-9]+)\.html" /index.php?main_page=page&id=$2&% last;
# All other pages
# Don’t rewrite real files or directories
#RewriteCond %{REQUEST_FILENAME} !-f [NC]
#RewriteCond %{REQUEST_FILENAME} !-d
rewrite "^(.*).html" /index.php?main_page=$1&% last;
#—————————Zen-Cart Rewrite End—————————
}
#PHP-INFO-START PHP引用配置,可以注释或修改
include enable-php-56.conf;
#PHP-INFO-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
#REWRITE-END
#禁止访问的文件或目录
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 /dev/null;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log off;
}
access_log /www/wwwlogs/bqdrone.com.log;
error_log /www/wwwlogs/bqdrone.com.error.log;
}
批量跳https http不能访问
server {
listen 80; #监听ipv4
listen [::]:80; #监听ipv6
server_name inminde.com www.inminde.com; #虚拟主机域名
rewrite ^(.*)$ https://$host$1 permanent; #rewrite跳转
}
网友评论