some fixes

This commit is contained in:
Robert Kaussow 2018-08-09 21:20:06 +02:00
parent 63e9ff2289
commit 152f0af922
3 changed files with 49 additions and 48 deletions

View File

@ -1,4 +1,5 @@
--- ---
nginx_official_repo_enabled: True
nginx_user: nginx nginx_user: nginx
nginx_group: nginx nginx_group: nginx
nginx_worker_processes: 1 nginx_worker_processes: 1
@ -7,12 +8,13 @@ nginx_open_ports:
- 80 - 80
- 443 - 443
nginx_tls_enabled: False nginx_tls_enabled: False
nginx_tls_cert: "" # nginx_tls_cert:
nginx_tls_private_key: "" # nginx_tls_private_key:
nginx_tls_intermediate_ca: "" # nginx_tls_intermediate_ca:
nginx_vhosts_dir: /var/www/vhosts
nginx_pfs_enabled: False nginx_pfs_enabled: False
nginx_dhparam_size: '4069' nginx_dhparam_size: 4069
nginx_dhparam_file: '/etc/pki/tls/certs/dhparam-{{ nginx_dhparam_size }}.pem' nginx_dhparam_file: "/etc/pki/tls/certs/dhparam-{{ nginx_dhparam_size }}.pem"
nginx_tls_cert_file: "/etc/pki/tls/certs/my-chained.crt" nginx_tls_cert_file: "/etc/pki/tls/certs/my-chained.crt"
nginx_tls_intermediate_ca_file: "/etc/pki/tls/certs/my-intermediate.crt" nginx_tls_intermediate_ca_file: "/etc/pki/tls/certs/my-intermediate.crt"
nginx_tls_private_key_file: "/etc/pki/tls/private/my-private.key" nginx_tls_private_key_file: "/etc/pki/tls/private/my-private.key"

View File

@ -8,6 +8,7 @@
baseurl: "https://nginx.org/packages/centos/{{ ansible_distribution_major_version }}/$basearch/" baseurl: "https://nginx.org/packages/centos/{{ ansible_distribution_major_version }}/$basearch/"
gpgkey: https://nginx.org/keys/nginx_signing.key gpgkey: https://nginx.org/keys/nginx_signing.key
gpgcheck: yes gpgcheck: yes
when: nginx_official_repo_enabled
- name: Installing nginx - name: Installing nginx
yum: yum:
@ -30,18 +31,18 @@
- name: Prepare vhost directories - name: Prepare vhost directories
file: file:
path: '{{ item }}' path: "{{ item }}"
state: directory state: directory
owner: nginx owner: nginx
group: nginx group: nginx
mode: 0750 mode: 0750
with_items: with_items:
- /var/www/vhosts - "{{ nginx_vhosts_dir }}"
- /var/www/vhosts/default - "{{ nginx_vhosts_dir }}/default"
- name: Prepare nginx directories - name: Prepare nginx directories
file: file:
path: '{{ item }}' path: "{{ item }}"
state: directory state: directory
owner: root owner: root
group: root group: root
@ -52,8 +53,8 @@
- name: Update nginx.conf - name: Update nginx.conf
template: template:
src: 'etc/nginx/nginx.conf.j2' src: etc/nginx/nginx.conf.j2
dest: '/etc/nginx/nginx.conf' dest: "/etc/nginx/nginx.conf"
owner: root owner: root
group: root group: root
mode: 0640 mode: 0640
@ -80,7 +81,7 @@
path: /etc/nginx/conf.d/default.conf path: /etc/nginx/conf.d/default.conf
state: absent state: absent
- name: Add default page config - name: Add default page configuration file
template: template:
src: 'etc/nginx/sites-available/default.j2' src: 'etc/nginx/sites-available/default.j2'
dest: '/etc/nginx/sites-available/default' dest: '/etc/nginx/sites-available/default'

View File

@ -5,52 +5,50 @@ worker_processes {{ nginx_worker_processes }};
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
pid /run/nginx.pid; pid /run/nginx.pid;
events { events {
worker_connections {{ nginx_worker_connections }}; worker_connections {{ nginx_worker_connections }};
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" ' '$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; '"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main; access_log /var/log/nginx/access.log main;
sendfile on; sendfile on;
tcp_nopush on; tcp_nopush on;
tcp_nodelay on; tcp_nodelay on;
types_hash_max_size 2048; types_hash_max_size 2048;
server_tokens off; server_tokens off;
## Buffers ## Buffers
client_body_buffer_size 10K; client_body_buffer_size 10K;
client_header_buffer_size 1k; client_header_buffer_size 1k;
client_max_body_size 8m; client_max_body_size 8m;
## Timeouts ## Timeouts
client_body_timeout 12; client_body_timeout 12;
client_header_timeout 12; client_header_timeout 12;
keepalive_timeout 15; keepalive_timeout 15;
send_timeout 10; send_timeout 10;
## Gzip Settings ## Gzip Settings
gzip on; gzip on;
gzip_comp_level 2; gzip_comp_level 2;
gzip_min_length 1000; gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth; gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/x-javascript text/xml text/css application/xml; gzip_types text/plain application/x-javascript text/xml text/css application/xml;
# Load modular configuration files from the /etc/nginx/conf.d directory. # Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include # See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information. # for more information.
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
## Virtual Host Configs ## Virtual Host Configs
include /etc/nginx/sites-enabled/*; include /etc/nginx/sites-enabled/*;
server_names_hash_bucket_size 64; server_names_hash_bucket_size 64;
} }