2016-05-02 13:31:38 +05:30
|
|
|
|
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"';
|
|
|
|
|
|
2016-05-31 23:35:18 +05:30
|
|
|
|
access_log /var/log/nginx/access.log main;
|
2016-05-02 13:31:38 +05:30
|
|
|
|
|
2016-05-31 23:35:18 +05:30
|
|
|
|
sendfile on;
|
|
|
|
|
keepalive_timeout 10;
|
2016-05-02 13:31:38 +05:30
|
|
|
|
|
|
|
|
|
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;
|
2016-06-16 01:07:30 +05:30
|
|
|
|
client_max_body_size 2M;
|
|
|
|
|
etag on;
|
2016-05-02 13:31:38 +05:30
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
alias $frontend_path;
|
|
|
|
|
index index.html;
|
|
|
|
|
try_files $uri /index.html =404;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location /api {
|
2016-05-31 23:35:18 +05:30
|
|
|
|
try_files $uri /api/web/index.php?$args;
|
2016-05-02 13:31:38 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location ~* \.php$ {
|
2016-05-31 23:35:18 +05:30
|
|
|
|
fastcgi_pass app:9000;
|
|
|
|
|
include fastcgi_params;
|
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
|
fastcgi_param SERVER_NAME $host;
|
2016-05-02 13:31:38 +05:30
|
|
|
|
}
|
|
|
|
|
|
2016-06-16 01:07:30 +05:30
|
|
|
|
# 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) {
|
2016-05-02 13:31:38 +05:30
|
|
|
|
root $frontend_path;
|
|
|
|
|
expires max;
|
|
|
|
|
access_log off;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|