Commit b6426fcf authored by xuchentao's avatar xuchentao

feat: enable production domain HTTPS

parent a7bff406
Pipeline #463 failed with stage
in 21 seconds
...@@ -9,7 +9,7 @@ variables: ...@@ -9,7 +9,7 @@ variables:
PM2_BIN: "/usr/bin/pm2" PM2_BIN: "/usr/bin/pm2"
PM2_HOME_DIR: "/root/.pm2" PM2_HOME_DIR: "/root/.pm2"
PM2_USE_SUDO: "1" PM2_USE_SUDO: "1"
PUBLIC_HOST: "jiayun.101-126-10-129.sslip.io" PUBLIC_HOST: "jiayunwangyueche.com"
stages: stages:
- deploy - deploy
...@@ -51,7 +51,7 @@ deploy: ...@@ -51,7 +51,7 @@ deploy:
sudo -n /usr/bin/systemctl reload nginx sudo -n /usr/bin/systemctl reload nginx
curl --fail --silent --show-error --max-time 5 \ curl --fail --silent --show-error --max-time 5 \
--header "Host: $PUBLIC_HOST" \ --resolve "$PUBLIC_HOST:443:127.0.0.1" \
http://127.0.0.1/ >/dev/null "https://$PUBLIC_HOST/" >/dev/null
echo "[deploy] 部署与公网入口验证完成" echo "[deploy] 部署与公网入口验证完成"
...@@ -6,7 +6,7 @@ import path from "node:path"; ...@@ -6,7 +6,7 @@ import path from "node:path";
const customOutDir = process.env.JIAYUN_BUILD_OUT_DIR; const customOutDir = process.env.JIAYUN_BUILD_OUT_DIR;
export default defineConfig({ export default defineConfig({
site: "http://jiayun.101-126-10-129.sslip.io", site: "https://jiayunwangyueche.com",
integrations: [sitemap({ filter: (page) => !page.includes("/admin/") && !page.includes("/api/") })], integrations: [sitemap({ filter: (page) => !page.includes("/admin/") && !page.includes("/api/") })],
adapter: node({ mode: "standalone" }), adapter: node({ mode: "standalone" }),
...(customOutDir ? { outDir: path.resolve(customOutDir) } : {}), ...(customOutDir ? { outDir: path.resolve(customOutDir) } : {}),
......
# 嘉运网约车官网 Nginx 配置 # 嘉运网约车官网 Nginx 配置
# 通过服务器 IP 的 80 端口访问,反向代理到本机 8790 端口。 # HTTP 入口跳转到正式域名的 HTTPS,应用服务监听本机 8790 端口。
server { server {
listen 80; listen 80;
server_name 101.126.10.129; server_name jiayunwangyueche.com;
return 301 https://jiayunwangyueche.com$request_uri;
}
server {
listen 443 ssl http2;
server_name jiayunwangyueche.com;
ssl_certificate /etc/nginx/certs/jiayunwangyueche.com.fullchain.pem;
ssl_certificate_key /etc/nginx/certs/jiayunwangyueche.com.certkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# 图片上限为 20MB,JSON 中的 Base64 数据会额外增大请求体。 # 图片上限为 20MB,JSON 中的 Base64 数据会额外增大请求体。
client_max_body_size 28m; client_max_body_size 28m;
......
...@@ -14,4 +14,4 @@ Allow: / ...@@ -14,4 +14,4 @@ Allow: /
Disallow: /admin/ Disallow: /admin/
Disallow: /api/ Disallow: /api/
Sitemap: http://jiayun.101-126-10-129.sslip.io/sitemap-index.xml Sitemap: https://jiayunwangyueche.com/sitemap-index.xml
...@@ -5,7 +5,7 @@ import { getPublishedArticles } from "../lib/articles"; ...@@ -5,7 +5,7 @@ import { getPublishedArticles } from "../lib/articles";
export const prerender = true; export const prerender = true;
export const GET: APIRoute = async ({ site: siteUrl }) => { export const GET: APIRoute = async ({ site: siteUrl }) => {
const base = (siteUrl?.href || "http://jiayun.101-126-10-129.sslip.io/").replace(/\/$/, ""); const base = (siteUrl?.href || "https://jiayunwangyueche.com/").replace(/\/$/, "");
const articles = await getPublishedArticles(); const articles = await getPublishedArticles();
const pages = [ const pages = [
[`首页`, "/"], [`服务方案`, "/services/"], [`司机招募`, "/join/"], [`首页`, "/"], [`服务方案`, "/services/"], [`司机招募`, "/join/"],
......
...@@ -2,7 +2,7 @@ import type { APIRoute } from "astro"; ...@@ -2,7 +2,7 @@ import type { APIRoute } from "astro";
import { site } from "../data/site"; import { site } from "../data/site";
export const prerender = true; export const prerender = true;
export const GET: APIRoute = ({ site: siteUrl }) => { export const GET: APIRoute = ({ site: siteUrl }) => {
const base = (siteUrl?.href || "http://jiayun.101-126-10-129.sslip.io/").replace(/\/$/, ""); const base = (siteUrl?.href || "https://jiayunwangyueche.com/").replace(/\/$/, "");
const body = `# ${site.brand.name}\n\n> ${site.brand.tagline}\n\n${site.home.subhead}\n\n## 核心服务\n${site.services.map((item) => `- ${item.name}${item.intro}`).join("\n")}\n\n## 联系方式\n- 电话:${site.contact.phone}\n- 地址:${site.contact.address}\n- 服务时间:${site.contact.serviceHours}\n\n## 重要页面\n- 完整 AI 资料:${base}/llms-full.txt\n- 首页:${base}/\n- 服务方案:${base}/services/\n- 司机招募:${base}/join/\n- 资讯中心:${base}/articles/\n- 关于嘉运:${base}/about/\n- 常见问题:${base}/faq/\n- 联系我们:${base}/contact/\n\n## 信息边界\n- 平台规则、准入条件、车型价格与优惠政策以实时信息为准。\n- 嘉运不对网约车营收作绝对承诺。\n`; const body = `# ${site.brand.name}\n\n> ${site.brand.tagline}\n\n${site.home.subhead}\n\n## 核心服务\n${site.services.map((item) => `- ${item.name}${item.intro}`).join("\n")}\n\n## 联系方式\n- 电话:${site.contact.phone}\n- 地址:${site.contact.address}\n- 服务时间:${site.contact.serviceHours}\n\n## 重要页面\n- 完整 AI 资料:${base}/llms-full.txt\n- 首页:${base}/\n- 服务方案:${base}/services/\n- 司机招募:${base}/join/\n- 资讯中心:${base}/articles/\n- 关于嘉运:${base}/about/\n- 常见问题:${base}/faq/\n- 联系我们:${base}/contact/\n\n## 信息边界\n- 平台规则、准入条件、车型价格与优惠政策以实时信息为准。\n- 嘉运不对网约车营收作绝对承诺。\n`;
return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } }); return new Response(body, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment