accounts/docker/nginx/nginx.conf

61 lines
1.5 KiB
Nginx Configuration File

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 10;
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 100M;
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;
}
# Раздача статики для frontend
location ~* ^.+\.(html|jpg|jpeg|gif|png|svg|js|json|css|zip|rar|eot|ttf|woff|ico) {
root $frontend_path;
expires max;
access_log off;
}
}
}