mirror of
https://github.com/elyby/accounts.git
synced 2025-02-27 21:22:49 +05:30
Добавлен внутренний редирект для кейса, когда запрос будет идти на старый домен
This commit is contained in:
parent
72a7f743be
commit
27a9f9d3f8
@ -20,6 +20,8 @@ services:
|
|||||||
- app
|
- app
|
||||||
volumes_from:
|
volumes_from:
|
||||||
- app
|
- app
|
||||||
|
environment:
|
||||||
|
- AUTHSERVER_HOST=authserver.ely.by
|
||||||
|
|
||||||
node-dev-server:
|
node-dev-server:
|
||||||
build: ./frontend
|
build: ./frontend
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
FROM nginx:1.9
|
FROM nginx:1.9
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
|
COPY account.ely.by.conf.template /etc/nginx/conf.d/account.ely.by.conf.template
|
||||||
|
COPY run.sh /run.sh
|
||||||
|
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf \
|
||||||
|
&& chmod a+x /run.sh
|
||||||
|
|
||||||
|
CMD ["/run.sh"]
|
||||||
|
54
docker/nginx/account.ely.by.conf.template
Normal file
54
docker/nginx/account.ely.by.conf.template
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
|
||||||
|
set $root_path '/var/www/html';
|
||||||
|
set $api_path '${root_path}/api/web';
|
||||||
|
set $frontend_path '${root_path}/frontend/dist';
|
||||||
|
set $authserver_host '${AUTHSERVER_HOST}';
|
||||||
|
|
||||||
|
root $root_path;
|
||||||
|
charset utf-8;
|
||||||
|
client_max_body_size 2M;
|
||||||
|
etag on;
|
||||||
|
|
||||||
|
set $request_url $request_uri;
|
||||||
|
if ($host = $authserver_host) {
|
||||||
|
set $request_url '/api/authserver${request_uri}';
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
if ($host = $authserver_host) {
|
||||||
|
rewrite ^ /api/authserver$uri last;
|
||||||
|
}
|
||||||
|
|
||||||
|
alias $frontend_path;
|
||||||
|
index index.html;
|
||||||
|
try_files $uri /index.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
try_files $uri $uri /api/web/index.php?$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.php$ {
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param SERVER_NAME $host;
|
||||||
|
fastcgi_param REQUEST_URI $request_url;
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# html файлы идут отдельно, для них будет применяться E-Tag кэширование
|
||||||
|
location ~* \.html$ {
|
||||||
|
root $frontend_path;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Раздача статики для frontend с указанием max-кэша. Сброс будет по #hash после ребилда webpackом
|
||||||
|
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|json|css|zip|rar|eot|ttf|woff|ico) {
|
||||||
|
root $frontend_path;
|
||||||
|
expires max;
|
||||||
|
access_log off;
|
||||||
|
}
|
||||||
|
}
|
@ -21,47 +21,5 @@ http {
|
|||||||
sendfile on;
|
sendfile on;
|
||||||
keepalive_timeout 10;
|
keepalive_timeout 10;
|
||||||
|
|
||||||
server {
|
include /etc/nginx/conf.d/*.conf;
|
||||||
listen 80;
|
|
||||||
|
|
||||||
set $root_path '/var/www/html';
|
|
||||||
set $api_path '${root_path}/api/web';
|
|
||||||
set $frontend_path '${root_path}/frontend/dist';
|
|
||||||
|
|
||||||
root $root_path;
|
|
||||||
charset utf-8;
|
|
||||||
client_max_body_size 2M;
|
|
||||||
etag on;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
alias $frontend_path;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri /index.html =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /api {
|
|
||||||
try_files $uri /api/web/index.php?$args;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~* \.php$ {
|
|
||||||
fastcgi_pass app:9000;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_param SERVER_NAME $host;
|
|
||||||
}
|
|
||||||
|
|
||||||
# html файлы идут отдельно, для них будет применяться E-Tag кэширование
|
|
||||||
location ~* \.html$ {
|
|
||||||
root $frontend_path;
|
|
||||||
access_log off;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Раздача статики для frontend с указанием max-кэша. Сброс будет по #hash после ребилда webpackом
|
|
||||||
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|json|css|zip|rar|eot|ttf|woff|ico) {
|
|
||||||
root $frontend_path;
|
|
||||||
expires max;
|
|
||||||
access_log off;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
4
docker/nginx/run.sh
Normal file
4
docker/nginx/run.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
envsubst '$AUTHSERVER_HOST' < /etc/nginx/conf.d/account.ely.by.conf.template > /etc/nginx/conf.d/default.conf
|
||||||
|
nginx -g 'daemon off;'
|
Loading…
x
Reference in New Issue
Block a user