Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f11abb226f | |||
| 7dde30748c |
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
||||
*
|
||||
!nginx.conf
|
||||
!docker-build-site.mjs
|
||||
!www.mewedding.vn/
|
||||
!www.mewedding.vn/**
|
||||
!w.ladicdn.com/
|
||||
!w.ladicdn.com/**
|
||||
9
.env
Normal file
9
.env
Normal file
@@ -0,0 +1,9 @@
|
||||
COMPOSE_PROJECT_NAME=wd-hn
|
||||
|
||||
IMAGE_NAME=toiiiiday/wd-hn-wedding
|
||||
IMAGE_TAG=1.0.0
|
||||
CONTAINER_NAME=wd-hn-wedding
|
||||
|
||||
HOST_PORT=6070
|
||||
PUBLIC_DOMAIN=hiepnhan.weddinghappy.asia
|
||||
SERVER_IP=172.20.235.176
|
||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM node:alpine AS site
|
||||
|
||||
WORKDIR /src
|
||||
COPY docker-build-site.mjs .
|
||||
COPY www.mewedding.vn ./www.mewedding.vn
|
||||
COPY w.ladicdn.com ./w.ladicdn.com
|
||||
RUN node docker-build-site.mjs
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=site /site/ /usr/share/nginx/html/
|
||||
|
||||
EXPOSE 6070
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1:6070/ >/dev/null || exit 1
|
||||
12
README.md
12
README.md
@@ -5,18 +5,18 @@ Website tĩnh (Ladipage). Cần chạy qua **web server cục bộ** — không
|
||||
## Cách nhanh nhất
|
||||
|
||||
1. Double-click file **`start.bat`** trong thư mục dự án.
|
||||
2. Trình duyệt sẽ mở: `http://localhost:8080/www.mewedding.vn/index.html`
|
||||
2. Trình duyệt sẽ mở: `http://localhost:8888/www.mewedding.vn/index.html`
|
||||
3. Dừng server: nhấn `Ctrl+C` trong cửa sổ đen (hoặc đóng cửa sổ).
|
||||
|
||||
## Mở qua WiFi (điện thoại / máy khác cùng mạng)
|
||||
|
||||
1. Máy tính và điện thoại **cùng WiFi** (không dùng guest network chặn LAN).
|
||||
2. Chạy **`start.bat`** — cửa sổ PowerShell in thêm dòng dạng:
|
||||
`http://192.168.x.x:8080/www.mewedding.vn/index.html`
|
||||
`http://192.168.x.x:8888/www.mewedding.vn/index.html`
|
||||
3. Trên điện thoại, mở đúng URL đó (thay `192.168.x.x` bằng IP hiện in ra).
|
||||
4. **Điện thoại không vào được** (hay gặp nhất):
|
||||
- Chạy lại **`setup-wifi.ps1`** (Admin) — script mở **firewall cổng 8080** và đặt Wi-Fi sang **Private**.
|
||||
- Trên điện thoại dùng đúng URL dòng **`>>> DIEN THOAI`** (thường `http://192.168.1.x:8080/...`), không dùng `localhost`.
|
||||
- Chạy lại **`setup-wifi.ps1`** (Admin) — script mở **firewall cổng 8888** và đặt Wi-Fi sang **Private**.
|
||||
- Trên điện thoại dùng đúng URL dòng **`>>> DIEN THOAI`** (thường `http://192.168.1.x:8888/...`), không dùng `localhost`.
|
||||
- Điện thoại **tắt 4G/5G**, chỉ dùng WiFi cùng nhà; tắt VPN trên PC/điện thoại.
|
||||
- Router: tắt **AP isolation / client isolation** nếu bật.
|
||||
- Cửa sổ `start.bat` có dòng `192.168.x.x -> ...` khi điện thoại truy cập → server nhận được; không có dòng → firewall/router chặn.
|
||||
@@ -28,9 +28,9 @@ Website tĩnh (Ladipage). Cần chạy qua **web server cục bộ** — không
|
||||
```
|
||||
Hoặc lệnh tay (**không** dùng `%USERNAME%` trong PowerShell — sẽ lỗi 1332):
|
||||
```powershell
|
||||
netsh http add urlacl url=http://+:8080/ user="$env:USERDOMAIN\$env:USERNAME"
|
||||
netsh http add urlacl url=http://+:8888/ user="$env:USERDOMAIN\$env:USERNAME"
|
||||
```
|
||||
Trong **CMD (Admin)** thì dùng được: `netsh http add urlacl url=http://+:8080/ user=%USERNAME%`
|
||||
Trong **CMD (Admin)** thì dùng được: `netsh http add urlacl url=http://+:8888/ user=%USERNAME%`
|
||||
|
||||
## Chạy bằng PowerShell
|
||||
|
||||
|
||||
56
docker-build-site.mjs
Normal file
56
docker-build-site.mjs
Normal file
@@ -0,0 +1,56 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const outDir = "/site";
|
||||
const indexPath = "www.mewedding.vn/index.html";
|
||||
const sourceDir = "www.mewedding.vn/source";
|
||||
|
||||
function decodeLocalAsset(rawUrl) {
|
||||
let url = rawUrl.split("?")[0];
|
||||
url = url.replaceAll("\\ ", " ");
|
||||
url = url.replace(/^\.\.\//, "");
|
||||
url = url.replace(/^\/+/, "");
|
||||
try {
|
||||
return decodeURIComponent(url);
|
||||
} catch {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyFilePreservingPath(relativePath) {
|
||||
const source = path.resolve(relativePath);
|
||||
const target = path.join(outDir, relativePath);
|
||||
await fs.mkdir(path.dirname(target), { recursive: true });
|
||||
await fs.copyFile(source, target);
|
||||
}
|
||||
|
||||
const html = await fs.readFile(indexPath, "utf8");
|
||||
await fs.rm(outDir, { recursive: true, force: true });
|
||||
await copyFilePreservingPath(indexPath);
|
||||
await fs.cp(sourceDir, path.join(outDir, sourceDir), { recursive: true });
|
||||
|
||||
const assetPattern =
|
||||
/(?:url\(["']?|src=["']|href=["']|"(?:dC|dw)"\s*:\s*")((?:\.\.\/|\/)w\.ladicdn\.com\/[^"')]+)/g;
|
||||
const assets = new Set();
|
||||
|
||||
for (const match of html.matchAll(assetPattern)) {
|
||||
assets.add(decodeLocalAsset(match[1]));
|
||||
}
|
||||
|
||||
const missing = [];
|
||||
for (const asset of assets) {
|
||||
try {
|
||||
await fs.access(asset);
|
||||
await copyFilePreservingPath(asset);
|
||||
} catch {
|
||||
missing.push(asset);
|
||||
}
|
||||
}
|
||||
|
||||
if (missing.length > 0) {
|
||||
console.error("Missing local assets:");
|
||||
for (const asset of missing) console.error(`- ${asset}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Prepared static site with ${assets.size} local assets.`);
|
||||
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
services:
|
||||
wedding-web:
|
||||
build: .
|
||||
image: ${IMAGE_NAME}:${IMAGE_TAG}
|
||||
container_name: ${CONTAINER_NAME}
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${HOST_PORT}:6070"
|
||||
38
nginx.conf
Normal file
38
nginx.conf
Normal file
@@ -0,0 +1,38 @@
|
||||
server {
|
||||
listen 6070;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
charset utf-8;
|
||||
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
|
||||
location = / {
|
||||
try_files /www.mewedding.vn/index.html =404;
|
||||
}
|
||||
|
||||
location = /index.html {
|
||||
try_files /www.mewedding.vn/index.html =404;
|
||||
}
|
||||
|
||||
location /w.ladicdn.com/ {
|
||||
try_files $uri =404;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||
}
|
||||
|
||||
location /www.mewedding.vn/source/ {
|
||||
try_files $uri =404;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||
}
|
||||
|
||||
location /www.mewedding.vn/ {
|
||||
try_files $uri $uri/ /www.mewedding.vn/index.html;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /www.mewedding.vn/index.html;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
|
||||
|
||||
<head>
|
||||
<base href="/">
|
||||
<meta charset="UTF-8">
|
||||
<title>THƯ MỜI THAM DỰ ĐÁM CƯỚI MINH HIỆP VÀ THANH NHÀN</title>
|
||||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
@@ -15,7 +16,7 @@
|
||||
<meta property="og:title" content="Thiệp mời Hiệp & Nhàn" />
|
||||
<meta property="og:description"
|
||||
content="Trân trọng kính mời bạn đến dự lễ cưới của Hiệp & Nhàn — lúc 17:00 ngày 06/06/2026. Nhấn để xem chi tiết!" />
|
||||
<meta property="og:url" content="https://minhhiep.weddinghappy.asia/" />
|
||||
<meta property="og:url" content="https://hiepnhan.weddinghappy.asia/" />
|
||||
<link rel="dns-prefetch">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com/" crossorigin>
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
|
||||
@@ -3630,6 +3631,40 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#PARAGRAPH124 .parent-lines,
|
||||
#PARAGRAPH126 .parent-lines {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#PARAGRAPH124 .parent-line,
|
||||
#PARAGRAPH126 .parent-line {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
margin: 0 0 4px;
|
||||
}
|
||||
|
||||
#PARAGRAPH124 .parent-line:last-child,
|
||||
#PARAGRAPH126 .parent-line:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#PARAGRAPH124 .parent-label,
|
||||
#PARAGRAPH126 .parent-label {
|
||||
flex: 0 0 68px;
|
||||
text-align: right;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
#PARAGRAPH124 .parent-name,
|
||||
#PARAGRAPH126 .parent-name {
|
||||
flex: 1 1 auto;
|
||||
font-weight: 700;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#GROUP105 {
|
||||
width: 217px;
|
||||
height: 305.335px;
|
||||
@@ -7204,7 +7239,7 @@
|
||||
<h3 class='ladi-headline ladi-transition'>SAVE THE DATE<br></h3>
|
||||
</div>
|
||||
<div id="HEADLINE113" class='ladi-element'>
|
||||
<h3 class='ladi-headline ladi-transition'>Bạn và người thương</h3>
|
||||
<h3 class='ladi-headline ladi-transition'>Quý Khách</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -7251,8 +7286,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="PARAGRAPH124" class='ladi-element'>
|
||||
<div class='ladi-paragraph ladi-transition'>Con ông : <span style="font-weight: 700;">Lê Tiến Lực
|
||||
</span><br>Con bà : <span style="font-weight: 700;">Mai Thị Thanh Tùng</span><br></div>
|
||||
<div class='ladi-paragraph ladi-transition'>
|
||||
<div class="parent-lines">
|
||||
<div class="parent-line"><span class="parent-label">Con ông :</span><span class="parent-name">Lê Tiến Lực</span></div>
|
||||
<div class="parent-line"><span class="parent-label">Con bà :</span><span class="parent-name">Mai Thị Thanh Tùng</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -7286,8 +7325,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="PARAGRAPH126" class='ladi-element'>
|
||||
<div class='ladi-paragraph ladi-transition'>Con ông : <span style="font-weight: 700;">Phùng Quốc Lập
|
||||
</span><br>Con bà : <span style="font-weight: 700;">Nguyễn Thị Thu Hà</span><br></div>
|
||||
<div class='ladi-paragraph ladi-transition'>
|
||||
<div class="parent-lines">
|
||||
<div class="parent-line"><span class="parent-label">Con ông :</span><span class="parent-name">Phùng Quốc Lập</span></div>
|
||||
<div class="parent-line"><span class="parent-label">Con bà :</span><span class="parent-name">Nguyễn Thị Thu Hà</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -10865,4 +10908,4 @@
|
||||
</body>
|
||||
|
||||
|
||||
</html><!--Publish time: Fri, 18 Jul 2025 10:12:40 GMT--><!--LadiPage build time: Thu, 17 Jul 2025 10:00:19 GMT-->
|
||||
</html><!--Publish time: Fri, 18 Jul 2025 10:12:40 GMT--><!--LadiPage build time: Thu, 17 Jul 2025 10:00:19 GMT-->
|
||||
|
||||
Reference in New Issue
Block a user