aboutsummaryrefslogtreecommitdiffstats
path: root/roles/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'roles/nginx')
-rw-r--r--roles/nginx/files/nginx_default_404.html4
-rw-r--r--roles/nginx/files/nginx_default_50x.html4
-rw-r--r--roles/nginx/files/nginx_default_favicon.png0
-rw-r--r--roles/nginx/files/nginx_default_index.html4
-rw-r--r--roles/nginx/files/nginx_default_robots.txt3
-rw-r--r--roles/nginx/handlers/main.yml7
-rw-r--r--roles/nginx/tasks/main.yml24
7 files changed, 46 insertions, 0 deletions
diff --git a/roles/nginx/files/nginx_default_404.html b/roles/nginx/files/nginx_default_404.html
new file mode 100644
index 0000000..5c918f2
--- /dev/null
+++ b/roles/nginx/files/nginx_default_404.html
@@ -0,0 +1,4 @@
+<html>
+<head><title>404: Not Found</title></head>
+<body>404: Not Found</body>
+</html>
diff --git a/roles/nginx/files/nginx_default_50x.html b/roles/nginx/files/nginx_default_50x.html
new file mode 100644
index 0000000..9af1842
--- /dev/null
+++ b/roles/nginx/files/nginx_default_50x.html
@@ -0,0 +1,4 @@
+<html>
+<head><title>50x: Server Error</title></head>
+<body>50x: Server Error</body>
+</html>
diff --git a/roles/nginx/files/nginx_default_favicon.png b/roles/nginx/files/nginx_default_favicon.png
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/roles/nginx/files/nginx_default_favicon.png
diff --git a/roles/nginx/files/nginx_default_index.html b/roles/nginx/files/nginx_default_index.html
new file mode 100644
index 0000000..6d805dc
--- /dev/null
+++ b/roles/nginx/files/nginx_default_index.html
@@ -0,0 +1,4 @@
+<html>
+<head><title>Index</title></head>
+<body>You probably shouldn't be seeing this, but hello anyways!</body>
+</html>
diff --git a/roles/nginx/files/nginx_default_robots.txt b/roles/nginx/files/nginx_default_robots.txt
new file mode 100644
index 0000000..e8d19f5
--- /dev/null
+++ b/roles/nginx/files/nginx_default_robots.txt
@@ -0,0 +1,3 @@
+# Disallow all bots for this server
+User-agent: *
+Disallow: /
diff --git a/roles/nginx/handlers/main.yml b/roles/nginx/handlers/main.yml
new file mode 100644
index 0000000..c63e4a3
--- /dev/null
+++ b/roles/nginx/handlers/main.yml
@@ -0,0 +1,7 @@
+---
+- name: test nginx
+ command: nginx -t
+ notify: reload nginx
+
+- name: restart nginx
+ service: name=nginx state=restarted enabled=yes
diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml
new file mode 100644
index 0000000..8b32f07
--- /dev/null
+++ b/roles/nginx/tasks/main.yml
@@ -0,0 +1,24 @@
+---
+- name: Install nginx
+ apt: name=nginx state=present
+
+- name: Copy nginx configuration for wordpress
+ template: src=default.conf dest=/etc/nginx/conf.d/default.conf
+ notify: restart nginx
+
+mkdir -p /srv/http/default
+
+- name: Setup default nginx pages
+ copy:
+ src: "{{item.src}}"
+ dest: "/srv/http/default/www/{{item.dest}}"
+ owner: www-data
+ group: www-data
+ force: no
+ tags:
+ - nginx
+ with_items:
+ - {src: "static_files/nginx_default_404.html", dest: "404.html"}
+ - {src: "static_files/nginx_default_50x.html", dest: "50x.html"}
+ - {src: "static_files/nginx_default_favicon.png", dest: "favicon.png"}
+ - {src: "static_files/nginx_default_index.html", dest: "index.html"}