2016-08-23 03:02:12 +05:30
|
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
|
2016-10-02 15:22:17 +05:30
|
|
|
|
root $root_path;
|
|
|
|
|
charset utf-8;
|
|
|
|
|
index index.html;
|
|
|
|
|
etag on;
|
2016-08-23 03:02:12 +05:30
|
|
|
|
|
2016-10-02 15:22:17 +05:30
|
|
|
|
# Это можно раскоментить для целей отладки
|
|
|
|
|
# rewrite_log on;
|
|
|
|
|
# error_log /var/log/nginx/error.log debug;
|
|
|
|
|
|
|
|
|
|
set $root_path '/var/www/html';
|
|
|
|
|
set $frontend_path '${root_path}/frontend/dist';
|
2016-08-23 03:02:12 +05:30
|
|
|
|
|
|
|
|
|
set $request_url $request_uri;
|
2016-09-07 20:26:30 +05:30
|
|
|
|
set $host_with_uri '${host}${request_uri}';
|
|
|
|
|
|
2016-09-21 13:43:43 +05:30
|
|
|
|
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/auth') {
|
2016-08-23 03:02:12 +05:30
|
|
|
|
set $request_url '/api/authserver${request_uri}';
|
2016-09-07 20:26:30 +05:30
|
|
|
|
rewrite ^/auth /api/authserver$uri last;
|
2016-08-23 03:02:12 +05:30
|
|
|
|
}
|
|
|
|
|
|
2016-09-21 13:43:43 +05:30
|
|
|
|
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/session') {
|
2016-09-07 20:26:30 +05:30
|
|
|
|
set $request_url '/api/minecraft${request_uri}';
|
|
|
|
|
rewrite ^/session /api/minecraft$uri last;
|
|
|
|
|
}
|
2016-08-23 03:02:12 +05:30
|
|
|
|
|
2016-09-21 13:43:43 +05:30
|
|
|
|
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/api/(user|profiles)') {
|
|
|
|
|
set $request_url '/api/mojang${request_uri}';
|
|
|
|
|
rewrite ^/api/(user|profiles) /api/mojang$uri last;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-07 20:26:30 +05:30
|
|
|
|
location / {
|
2016-08-23 03:02:12 +05:30
|
|
|
|
alias $frontend_path;
|
|
|
|
|
try_files $uri /index.html =404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location /api {
|
2016-10-15 18:13:35 +05:30
|
|
|
|
try_files $uri $uri /api/web/index.php$is_args$args;
|
2016-08-23 03:02:12 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location ~* \.php$ {
|
2016-09-16 03:58:28 +05:30
|
|
|
|
fastcgi_pass php:9000;
|
2016-08-23 03:02:12 +05:30
|
|
|
|
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ом
|
2016-10-11 13:58:10 +05:30
|
|
|
|
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|json|css|zip|rar|eot|ttf|woff|woff2|ico)$ {
|
2016-08-23 03:02:12 +05:30
|
|
|
|
root $frontend_path;
|
|
|
|
|
expires max;
|
2016-10-02 15:22:17 +05:30
|
|
|
|
etag off;
|
2016-08-23 03:02:12 +05:30
|
|
|
|
access_log off;
|
|
|
|
|
}
|
2016-10-02 15:22:17 +05:30
|
|
|
|
|
|
|
|
|
# Запросы к статике для email, их нужно запустить внутрь vendor
|
|
|
|
|
location ^~ /images/emails/assets {
|
|
|
|
|
rewrite ^/images/emails/assets/(.+)$ /vendor/ely/emails-renderer/dist/assets/$1 last;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location ^~ /vendor/ely/emails-renderer/dist/assets {
|
|
|
|
|
alias '${root_path}/vendor/ely/email-renderer/dist/assets';
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
}
|
2016-08-23 03:02:12 +05:30
|
|
|
|
}
|