initial ansible code
This commit is contained in:
79
roles/webserver/templates/nginx.conf.j2
Normal file
79
roles/webserver/templates/nginx.conf.j2
Normal file
@@ -0,0 +1,79 @@
|
||||
## Managed by Ansible ##
|
||||
|
||||
user {{ webserver_user }};
|
||||
pid /var/run/nginx.pid;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
|
||||
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
|
||||
worker_processes {{ webserver_nginx_worker_processes }};
|
||||
|
||||
# number of file descriptors used for nginx
|
||||
# the limit for the maximum FDs on the server is usually set by the OS.
|
||||
# if you don't set FD's then OS settings will be used which is by default 2000
|
||||
worker_rlimit_nofile {{ webserver_nginx_worker_rlimit_nofile }};
|
||||
|
||||
# only log critical errors
|
||||
error_log /var/log/nginx/error.log crit;
|
||||
|
||||
# provides the configuration file context in which the directives that affect connection processing are specified.
|
||||
events {
|
||||
# determines how much clients will be served per worker
|
||||
# max clients = worker_connections * worker_processes
|
||||
# max clients is also limited by the number of socket connections available on the system (~64k)
|
||||
worker_connections 8192;
|
||||
# optmized to serve many clients with each thread, essential for linux -- for testing environment
|
||||
use epoll;
|
||||
|
||||
# accept as many connections as possible, may flood worker connections if set too low -- for testing environment
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
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" '
|
||||
'$request_time $upstream_response_time $ssl_protocol '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
aio threads;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
reset_timedout_connection on;
|
||||
|
||||
# reduce the data that needs to be sent over network -- for testing environment
|
||||
gzip on;
|
||||
# gzip_static on;
|
||||
gzip_min_length 10240;
|
||||
gzip_comp_level 1;
|
||||
gzip_vary on;
|
||||
gzip_disable msie6;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types
|
||||
# text/html is always compressed by HttpGzipModule
|
||||
text/css
|
||||
text/javascript
|
||||
text/xml
|
||||
text/plain
|
||||
text/x-component
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/rss+xml
|
||||
application/atom+xml
|
||||
font/truetype
|
||||
font/opentype
|
||||
application/vnd.ms-fontobject
|
||||
image/svg+xml;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/global/*.conf;
|
||||
|
||||
server_tokens off;
|
||||
}
|
||||
Reference in New Issue
Block a user