119 строки
3.5 KiB
Nginx Configuration File
119 строки
3.5 KiB
Nginx Configuration File
|
|
worker_processes auto;
|
|
error_log /var/log/nginx/error.log;
|
|
pid /run/nginx.pid;
|
|
|
|
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
|
|
include /usr/share/nginx/modules/*.conf;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
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;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
|
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
|
# for more information.
|
|
#include /etc/nginx/conf.d/*.conf;
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
server_name _;
|
|
#root /usr/share/nginx/html;
|
|
|
|
gzip on;
|
|
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css application/xml application/json text/csv;
|
|
gzip_min_length 1000;
|
|
gzip_buffers 4 8k;
|
|
gzip_http_version 1.0;
|
|
gzip_disable "msie6";
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
|
|
client_max_body_size 30M;
|
|
|
|
# Load configuration files for the default server block.
|
|
#include /etc/nginx/default.d/*.conf;
|
|
|
|
location / {
|
|
include uwsgi_params;
|
|
uwsgi_read_timeout 60s;
|
|
uwsgi_send_timeout 60s;
|
|
uwsgi_pass unix:/app/service.sock;
|
|
}
|
|
|
|
error_page 500 /500.html;
|
|
location /500.html{
|
|
return 500 '{"status_code": 500,"message": "Internal Server Error"}';
|
|
}
|
|
|
|
error_page 502 /502.html;
|
|
location /502.html{
|
|
return 502 '{"status_code": 502,"message": "Server is currently under heavy load. Please try again in a few moments."}';
|
|
}
|
|
|
|
error_page 503 /503.html;
|
|
location /503.html{
|
|
return 503 '{"status_code": 503,"message": "Service Temporarily Unavailable"}';
|
|
}
|
|
|
|
error_page 504 /504.html;
|
|
location /504.html{
|
|
return 504 '{"status_code": 504,"message": "Gateway Timeout"}';
|
|
}
|
|
|
|
error_page 400 /400.html;
|
|
location /400.html{
|
|
return 400 '{"status_code": 400,"message": "Bad Request"}';
|
|
}
|
|
|
|
error_page 401 /401.html;
|
|
location /401.html{
|
|
return 401 '{"status_code": 401,"message": "Unauthorized"}';
|
|
}
|
|
|
|
error_page 403 /403.html;
|
|
location /403.html{
|
|
return 403 '{"status_code": 403,"message": "Forbidden"}';
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
location /404.html{
|
|
return 404 '{"status_code": 404,"message": "Not Found"}';
|
|
}
|
|
|
|
error_page 408 /408.html;
|
|
location /408.html{
|
|
return 408 '{"status_code": 408,"message": "Request Timeout"}';
|
|
}
|
|
|
|
error_page 429 /429.html;
|
|
location /429.html{
|
|
return 429 '{"status_code": 429,"message": "Too Many Requests. Try again in a few seconds."}';
|
|
}
|
|
|
|
error_page 418 /418.html;
|
|
location /418.html{
|
|
return 418 '{"status_code": 418,"message": "I\'m a teapot"}';
|
|
}
|
|
|
|
}
|
|
}
|