mirror of
https://github.com/elyby/accounts.git
synced 2024-12-27 23:50:19 +05:30
df1859f0c1
Исправлена ошибка доступа к authserver из-за перехода на использование хостов, а не доменов
66 lines
2.0 KiB
Plaintext
66 lines
2.0 KiB
Plaintext
server {
|
||
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;
|
||
|
||
set $request_url $request_uri;
|
||
set $host_with_uri '${host}${request_uri}';
|
||
|
||
rewrite_log on;
|
||
error_log /var/log/nginx/error.log debug;
|
||
|
||
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/auth') {
|
||
set $request_url '/api/authserver${request_uri}';
|
||
rewrite ^/auth /api/authserver$uri last;
|
||
}
|
||
|
||
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/session') {
|
||
set $request_url '/api/minecraft${request_uri}';
|
||
rewrite ^/session /api/minecraft$uri last;
|
||
}
|
||
|
||
if ($host_with_uri ~ '^${AUTHSERVER_HOST}/api/(user|profiles)') {
|
||
set $request_url '/api/mojang${request_uri}';
|
||
rewrite ^/api/(user|profiles) /api/mojang$uri last;
|
||
}
|
||
|
||
location / {
|
||
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 php: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;
|
||
}
|
||
}
|