Ver código fonte

Support custom 404 pages in blog

Thomas Buck 5 anos atrás
pai
commit
efc165f792

+ 9
- 0
roles/blog/tasks/blog.yml Ver arquivo

53
     force=no
53
     force=no
54
   with_items: "{{ virtual_domains }}"
54
   with_items: "{{ virtual_domains }}"
55
 
55
 
56
+- name: Create an example blog 404 error page
57
+  template:
58
+    src=var_www_blog_404.j2
59
+    dest={{ item.doc_root }}/404.html
60
+    owner=www-data
61
+    group=www-data
62
+    force=no
63
+  with_items: "{{ virtual_domains }}"
64
+
56
 - name: Create the Apache blog sites config files
65
 - name: Create the Apache blog sites config files
57
   template:
66
   template:
58
     src=etc_apache2_sites-available_blog.j2
67
     src=etc_apache2_sites-available_blog.j2

+ 1
- 0
roles/blog/templates/etc_apache2_sites-available_blog.j2 Ver arquivo

20
     Options                 -Indexes
20
     Options                 -Indexes
21
     HostnameLookups         Off
21
     HostnameLookups         Off
22
     php_admin_flag          engine On
22
     php_admin_flag          engine On
23
+    ErrorDocument           404 /404.html
23
 </VirtualHost>
24
 </VirtualHost>

+ 9
- 0
roles/blog/templates/var_www_blog_404.j2 Ver arquivo

1
+<html>
2
+	<head>
3
+		<title>404 - Page not found</title>
4
+	</head>
5
+	<body>
6
+		<h1>404 - {{ item.name }}</h1>
7
+		<p>Requested page could not be found!</p>
8
+	</body>
9
+</html>

Carregando…
Cancelar
Salvar