nginx-cn/conf/nginx.conf

124 lines
2.6 KiB
Nginx Configuration File
Raw Normal View History

# nginx.conf
user http;
worker_processes 24; # CHANGE to fit your system
error_log /var/log/nginx/error.log;
pcre_jit on;
events {
worker_connections 4096;
use epoll;
multi_accept off;
accept_mutex off;
}
http {
# Lua path
lua_package_path "/opt/nginx/lib/lua/?.lua;;";
vhost_traffic_status_zone;
include mime.types;
default_type application/octet-stream;
# this is defined as a nicity here, and used by other files
map $http_upgrade $connection_upgrade {
default upgrade;
'' keep-alive;
}
log_format main '$remote_addr - $remote_user [$time_local] '
'"$server_name" "$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent' ;
# CHANGE if you want to use systemd for journaling (probably not a bad idea), or some other syslogd (again, probably
# not the worst idea), uncomment out this
# access_log syslog:server=unix:/dev/log,facility=local7,tag=nginx,severity=info main;
access_log /var/log/nginx/access.log main;
server_tokens off;
#map_hash_bucket_size 128;
#map_hash_max_size 8192;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# :(
keepalive_timeout 3605;
#keepalive_timeout 65;
#send_timeout 60;
send_timeout 3600;
reset_timedout_connection on;
types_hash_max_size 4096;
gzip on;
#gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 3;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 10240;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
server {
access_log /dev/null; # avoid spamming our access logs with accesses to this
# (do log errors though!)
listen 127.0.0.1:3950 bind reuseport;
location /status {
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
}
}
# A dummy default server just to avoid any configuration mishaps.
# Also sets our bind and reuseport options for us :)
server {
server_name _;
listen (ipv4):80 bind reuseport default_server; # CHANGE like template.conf tells you to
listen [(ipv6)]:80 bind reuseport default_server;
# a nice message if anyone else see this
default_type 'text/plain';
location ^~ / {
content_by_lua_block {
ngx.say('You should not see this message (unless some infrastructure is screwing up and not passing a Host header). If you do yell loudly.')
}
}
}
# include all enabled sites
include sites/*;
}