fix bugs
This commit is contained in:
parent
5bc41c853f
commit
bb79295969
@ -5,14 +5,6 @@
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Ensure Nginx is enabled and started
|
||||
systemd:
|
||||
name: nginx
|
||||
enabled: yes
|
||||
state: started
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Create directory for error pages
|
||||
file:
|
||||
path: /var/www/errors
|
||||
@ -43,5 +35,23 @@
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
mode: '0644'
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Test Nginx Configuration
|
||||
command: nginx -t
|
||||
register: nginx_test
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Fail if Nginx Configuration Test Failed
|
||||
fail:
|
||||
msg: "Nginx configuration test failed. Check the configuration files."
|
||||
when: nginx_test.rc != 0
|
||||
|
||||
- name: Ensure Nginx is enabled and started
|
||||
systemd:
|
||||
name: nginx
|
||||
enabled: yes
|
||||
state: started
|
||||
notify:
|
||||
- Restart Nginx
|
@ -1,10 +1,10 @@
|
||||
user nginx;
|
||||
worker_processes {{ nginx_worker_processes }};
|
||||
error_log {{ nginx_error_log }} {{ nginx_error_log_level }};
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections {{ nginx_worker_connections }};
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
@ -15,13 +15,13 @@ http {
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log {{ nginx_access_log }} main;
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
||||
types_hash_max_size {{ nginx_types_hash_max_size }};
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
@ -5,11 +5,27 @@
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Ensure Nginx is enabled and started
|
||||
systemd:
|
||||
name: nginx
|
||||
enabled: yes
|
||||
state: started
|
||||
- name: Deploy Main Nginx Configuration
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
mode: '0644'
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy SiteA Configuration
|
||||
template:
|
||||
src: siteA.conf.j2
|
||||
dest: /etc/nginx/conf.d/siteA.conf
|
||||
when: "'SiteA' in group_names"
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy SiteB Configuration
|
||||
template:
|
||||
src: siteB.conf.j2
|
||||
dest: /etc/nginx/conf.d/siteB.conf
|
||||
when: "'SiteB' in group_names"
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
@ -35,22 +51,6 @@
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy SiteA Configuration
|
||||
template:
|
||||
src: siteA.conf.j2
|
||||
dest: /etc/nginx/conf.d/siteA.conf
|
||||
when: "'SiteA' in group_names"
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy SiteB Configuration
|
||||
template:
|
||||
src: siteB.conf.j2
|
||||
dest: /etc/nginx/conf.d/siteB.conf
|
||||
when: "'SiteB' in group_names"
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy SiteA HTML
|
||||
template:
|
||||
src: index.html.j2
|
||||
@ -77,10 +77,10 @@
|
||||
notify:
|
||||
- Restart Nginx
|
||||
|
||||
- name: Deploy Main Nginx Configuration
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/nginx.conf
|
||||
mode: '0644'
|
||||
- name: Ensure Nginx is enabled and started
|
||||
systemd:
|
||||
name: nginx
|
||||
enabled: yes
|
||||
state: started
|
||||
notify:
|
||||
- Restart Nginx
|
@ -1,10 +1,10 @@
|
||||
user nginx;
|
||||
worker_processes {{ nginx_worker_processes }};
|
||||
error_log {{ nginx_error_log }} {{ nginx_error_log_level }};
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections {{ nginx_worker_connections }};
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
@ -15,13 +15,13 @@ http {
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log {{ nginx_access_log }} main;
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout {{ nginx_keepalive_timeout }};
|
||||
types_hash_max_size {{ nginx_types_hash_max_size }};
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
Loading…
Reference in New Issue
Block a user