ssr
Gitea Actions Demo / build_and_push (push) Successful in 1m14s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m14s
Details
This commit is contained in:
parent
8e0730aaeb
commit
95687bda3a
|
|
@ -26,7 +26,8 @@ COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
COPY --from=build /app/node_modules /app/node_modules
|
COPY --from=build /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/server /app/server
|
COPY --from=build /app/server /app/server
|
||||||
COPY --from=build /app/package.json /app/package.json
|
COPY --from=build /app/package.json /app/package.json
|
||||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|
|
||||||
109
nginx.conf
109
nginx.conf
|
|
@ -1,61 +1,76 @@
|
||||||
server {
|
worker_processes auto;
|
||||||
listen 80;
|
pid /tmp/nginx.pid;
|
||||||
server_name localhost;
|
|
||||||
gzip on;
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
gzip_comp_level 6;
|
gzip_comp_level 6;
|
||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/rss+xml image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype;
|
||||||
|
|
||||||
# SSR routes (search bots + guests get real HTML)
|
server {
|
||||||
location ~ ^/(explore|routes|sitemap\.xml|robots\.txt)$ {
|
listen 80;
|
||||||
proxy_pass http://127.0.0.1:3001;
|
server_name localhost;
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header Cookie $http_cookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Public workout detail — SSR
|
# SSR routes (search bots + guests get real HTML)
|
||||||
location ~ ^/public/workouts/ {
|
location ~ ^/(explore|routes|sitemap\.xml|robots\.txt)$ {
|
||||||
proxy_pass http://127.0.0.1:3001;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header Cookie $http_cookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Landing page: SSR if no auth cookie, SPA if has token
|
|
||||||
location = / {
|
|
||||||
hascookie token .;
|
|
||||||
if ($cookie_token = "") {
|
|
||||||
proxy_pass http://127.0.0.1:3001;
|
proxy_pass http://127.0.0.1:3001;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Cookie $http_cookie;
|
proxy_set_header Cookie $http_cookie;
|
||||||
}
|
}
|
||||||
# If cookie present → fall through to static (SPA handles redirect)
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
try_files /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Everything else → SPA
|
# Public workout detail — SSR
|
||||||
location / {
|
location ~ ^/public/workouts/ {
|
||||||
root /usr/share/nginx/html;
|
proxy_pass http://127.0.0.1:3001;
|
||||||
try_files $uri /index.html;
|
proxy_set_header Host $host;
|
||||||
}
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Cookie $http_cookie;
|
||||||
|
}
|
||||||
|
|
||||||
# Static assets
|
# Landing page: SSR if no auth cookie, SPA if has token
|
||||||
location /assets/ {
|
location = / {
|
||||||
root /usr/share/nginx/html;
|
hascookie token .;
|
||||||
expires 30d;
|
if ($cookie_token = "") {
|
||||||
add_header Cache-Control "public, immutable";
|
proxy_pass http://127.0.0.1:3001;
|
||||||
}
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header Cookie $http_cookie;
|
||||||
|
}
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
try_files /index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
# Everything else → SPA
|
||||||
location = /50x.html {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
}
|
try_files $uri /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
location ~ /\. {
|
# Static assets
|
||||||
deny all;
|
location /assets/ {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
expires 30d;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\. {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
<span>Дата:</span> {{ formatTime(item.workouted_at) }}
|
<span>Дата:</span> {{ formatTime(item.workouted_at) }}
|
||||||
</li>
|
</li>
|
||||||
<li v-if="item.photos && item.photos.length > 0">
|
<li v-if="item.photos && item.photos.length > 0">
|
||||||
|
|
||||||
<span>Фото:</span> {{ item.photos.length }}
|
<span>Фото:</span> {{ item.photos.length }}
|
||||||
</li>
|
</li>
|
||||||
<li v-if="item.speed">
|
<li v-if="item.speed">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue