-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf.example
More file actions
54 lines (44 loc) · 1.75 KB
/
Copy pathnginx.conf.example
File metadata and controls
54 lines (44 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# /etc/nginx/sites-available/math-base
# symlink в sites-enabled, отредактируй server_name
# ── Основной домен: статика из /var/www/math-base ────────────────────
server {
listen 80;
server_name oipav.ru www.oipav.ru;
# return 301 https://$host$request_uri; # после certbot
root /var/www/math-base;
index index.html;
# Astro строит маршруты без .html в URL (trailingSlash: never).
# Сначала пробуем точное соответствие, затем index.html в директории,
# затем 404.
location / {
try_files $uri $uri/index.html $uri.html =404;
}
# Долгий кэш для иммутабельных ассетов
location /_astro/ {
access_log off;
expires 1y;
add_header Cache-Control "public, immutable";
}
}
# ── blog.oipav.ru → читает из той же статики, но с префиксом /blog ───
# Раньше эту переадресацию делал next middleware. Теперь это nginx.
server {
listen 80;
server_name blog.oipav.ru;
# return 301 https://$host$request_uri; # после certbot
root /var/www/math-base;
index index.html;
location = / {
try_files /blog/index.html =404;
}
location / {
# blog.oipav.ru/foo → /var/www/math-base/blog/foo[/index.html]
try_files /blog$uri /blog$uri/index.html /blog$uri.html =404;
}
location /_astro/ {
access_log off;
expires 1y;
add_header Cache-Control "public, immutable";
}
}
# HTTPS-блоки добавит certbot --nginx -d oipav.ru -d www.oipav.ru -d blog.oipav.ru