-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx_copy_test.conf
152 lines (128 loc) · 5.02 KB
/
nginx_copy_test.conf
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
server {
listen 80;
# listen 443 ssl http2;
# server_name test2.openebench.bsc.es;
# Servir contenido estático (frontend)
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location /_nuxt/ {
try_files $uri $uri/ =404; # Asegura que los archivos estáticos se sirvan correctamente
}
# Pasar rutas dinámicas (/api/*) al servidor de Nuxt
location /api {
proxy_pass http://127.0.0.1:3000; # Puerto donde corre Nuxt server
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Manejar errores 404
error_page 404 /index.html;
# Proxy para las rutas del backend (API)
# location /server/ {
# proxy_pass http://127.0.0.1:3000; # Backend de Nuxt
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
# }
# location /api/ {
# proxy_pass http://127.0.0.1:3000; # El puerto donde Nuxt está corriendo en el contenedor
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
# }
# location / {
# proxy_pass http://127.0.0.1:3000; # Nuxt backend
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
# }
# Rutas estáticas servidas por Nginx
# location / {
# root /usr/share/nginx/html;
# index index.html;
# try_files $uri $uri/ /index.html;
# }
}
# server {
# listen 80; # Nginx escucha en el puerto 80, expuesto al host
# server_name test2.openebench.bsc.es; # O puedes especificar tu dominio si es necesario
# # Proxy para las rutas del backend (API)
# location /server/ {
# proxy_pass http://127.0.0.1:3000; # Backend de Nuxt
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
# }
# # Rutas estáticas servidas por Nginx
# location / {
# root /usr/share/nginx/html;
# index index.html;
# try_files $uri $uri/ /index.html;
# }
# # Directorio de los archivos estáticos generados por Nuxt
# # root /app/.output/public;
# # Servir archivos estáticos (JS, CSS, imágenes, etc.)
# # location /_nuxt/ {
# # try_files $uri $uri/ =404; # Asegura que los archivos estáticos se sirvan correctamente
# # }
# # Rutas dinámicas (API - Proxy a Nuxt backend)
# # location /api/ {
# # proxy_pass http://localhost:3000; # Redirige las solicitudes de la API al servidor Nuxt
# # proxy_http_version 1.1;
# # proxy_set_header Upgrade $http_upgrade;
# # proxy_set_header Connection 'upgrade';
# # proxy_set_header Host $host;
# # proxy_cache_bypass $http_upgrade;
# # }
# # location / {
# # root /usr/share/nginx/html;
# # index index.html;
# # try_files $uri $uri/ /index.html;
# # }
# # location /api/ {
# # proxy_pass http://localhost:3000; # Redirige a Nuxt backend en el puerto 3000
# # proxy_http_version 1.1;
# # proxy_set_header Upgrade $http_upgrade;
# # proxy_set_header Connection 'upgrade';
# # proxy_set_header Host $host;
# # proxy_cache_bypass $http_upgrade;
# # }
# # location / {
# # proxy_pass http://localhost:3000; # Aquí hacemos el proxy hacia el puerto 3000 dentro del contenedor
# # proxy_http_version 1.1;
# # proxy_set_header Upgrade $http_upgrade;
# # proxy_set_header Connection 'upgrade';
# # proxy_set_header Host $host;
# # proxy_cache_bypass $http_upgrade;
# # # # Para asegurar que la aplicación Nuxt se ejecute correctamente
# # # 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;
# # }
# # # Redirigir rutas de API al servidor Nuxt
# # location /api {
# # proxy_pass http://localhost:3000; # Servidor Nuxt escuchando en el puerto 3000
# # proxy_http_version 1.1;
# # proxy_set_header Upgrade $http_upgrade;
# # proxy_set_header Connection 'upgrade';
# # proxy_set_header Host $host;
# # proxy_cache_bypass $http_upgrade;
# # }
# # # Archivos estáticos (opcional, si usas `nuxt generate`)
# # location /_nuxt/ {
# # root /var/www/nuxt;
# # }
# }