try deploy

This commit is contained in:
nitros 2025-05-04 15:12:39 +07:00
parent 3cf46bdcbd
commit 3a1d77e538
4 changed files with 21 additions and 13 deletions

View File

@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
export default defineConfig({ export default defineConfig({
base: '/go/', // 👈 Это ключевая строка
plugins: [vue()], plugins: [vue()],
server: { server: {
port: 3000 port: 3000

View File

@ -48,10 +48,13 @@ func main() {
// Initialize random seed // Initialize random seed
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
// Serve static files // Serve static files
fs := http.FileServer(http.Dir("./frontend/dist")) fs := http.FileServer(http.Dir("./frontend/dist"))
http.Handle("/", fs) http.Handle("/", fs)
// WebSocket endpoint // WebSocket endpoint
http.HandleFunc("/go/ws", handleWebSocket) http.HandleFunc("/go/ws", handleWebSocket)

View File

@ -51,18 +51,20 @@ server {
try_files $uri $uri/ =404; try_files $uri $uri/ =404;
} }
location /go/ { location /go/ {
proxy_pass http://127.0.0.1:8080/; proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
location /assets/ { location /go/assets/ {
proxy_pass http://127.0.0.1:8080/assets/; proxy_pass http://127.0.0.1:8080/assets/;
proxy_set_header Host $host; proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
} }
location /go/ws { # is important here no slash in the end location /go/ws { # is important here no slash in the end
proxy_pass http://127.0.0.1:8080/go/ws; # and here no slash in the end proxy_pass http://127.0.0.1:8080/go/ws; # and here no slash in the end

View File

@ -25,12 +25,14 @@ server {
} }
location /go/ { location /go/ {
proxy_pass http://127.0.0.1:8080/; proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
} }
location /assets/ { location /go/assets/ {
proxy_pass http://127.0.0.1:8080/assets/; proxy_pass http://127.0.0.1:8080/assets/;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;