diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2016-08-28 16:08:42 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2016-08-28 16:14:56 +0200 |
| commit | 68515bbb478f326a252ca688fcc97f3fdc8c4f97 (patch) | |
| tree | 05954f1bf339c6ad973ed07736e0d328d5fbe3db /roles/nginx | |
| download | ansible-68515bbb478f326a252ca688fcc97f3fdc8c4f97.tar.gz ansible-68515bbb478f326a252ca688fcc97f3fdc8c4f97.tar.bz2 ansible-68515bbb478f326a252ca688fcc97f3fdc8c4f97.zip | |
Initial commit, finally got around to cleanup and make it into a
gitrepo.
Diffstat (limited to 'roles/nginx')
| -rw-r--r-- | roles/nginx/meta/main.yml | 4 | ||||
| -rw-r--r-- | roles/nginx/tasks/main.yml | 29 | ||||
| -rw-r--r-- | roles/nginx/templates/nginx.conf.j2 | 32 |
3 files changed, 65 insertions, 0 deletions
diff --git a/roles/nginx/meta/main.yml b/roles/nginx/meta/main.yml new file mode 100644 index 0000000..e444b13 --- /dev/null +++ b/roles/nginx/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - { role: lets_encrypt } + - { role: www_user } diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml new file mode 100644 index 0000000..d8540e8 --- /dev/null +++ b/roles/nginx/tasks/main.yml @@ -0,0 +1,29 @@ +--- +- name: Install nginx + become: yes + pacman: name={{ item }} state=present update_cache=yes + with_items: + - nginx + +- name: Create virtual hosts folder + become: yes + file: path=/etc/nginx/{{ item }} state=directory + with_items: + - sites-enabled + - sites-available + +- name: Create log folder + become: yes + file: path=/etc/nginx/logs state=directory + +- name: Copy nginx.conf + become: yes + template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf + +- name: Create /var/www + become: yes + file: path=/var/www state=directory owner={{ www_user }} group={{ www_user }} + +- name: Start and enable nginx + become: yes + service: name=nginx state=started enabled=yes diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2 new file mode 100644 index 0000000..756ff52 --- /dev/null +++ b/roles/nginx/templates/nginx.conf.j2 @@ -0,0 +1,32 @@ + +user {{www_user}}; +worker_processes 1; + +error_log logs/error.log; +error_log logs/error.log notice; +error_log logs/error.log info; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log logs/access.log main; + + #sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/sites-enabled/*; +} |
