user omadmin nginx;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
pid /var/run/openresty.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
#default_type application/octet-stream;
charset utf-8;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 500m;
client_body_buffer_size 1024k;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
proxy_ignore_client_abort on;
server_tokens off;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 3000;
fastcgi_read_timeout 3000;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
#gzip on;
#gzip_min_length 1k;
#gzip_buffers 4 16k;
#gzip_http_version 1.0;
#gzip_comp_level 2;
#gzip_types text/plain application/x-_javascript_ text/css application/xml;
#gzip_vary on;
lua_package_path "/data/webserver/openresty/lualib/?.lua;;";
log_format access '$remote_addr - $host $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$request_body" "$http_x_forwarded_for" - "$http_soapaction" "$upstream_response_time" "$request_time"';
init_by_lua '
require "resty.core"
template = require "resty.template"
template.caching(true); -- you may remove this on production
';
init_worker_by_lua_file /data/www/atomic/app/cron_job.lua;
server {
listen 80;
server_name www.xxx.com;
charset utf-8;
#autoindex on;
location = /favicon.ico {
log_not_found off;
access_log off;
}
set $template_location /templates;
location /templates {
internal;
alias /data/www/atomic/static/;
}
set $path /data/www/atomic/app;
location /v1/dx {
default_type 'text/html';
content_by_lua_file $path/dl.lua;
log_by_lua_file $path/log_client.lua;
}
location /{
default_type 'text/html';
content_by_lua_file $path/v1.lua;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
access_log /data/log/nginx/api.xxx.access.log access;
error_log /data/log/nginx/api.xxx.error.log debug;
}
}
stream {
server {
listen 6678;
content_by_lua_file /data/www/atomic/app/log_server.lua;
}
}