Compare commits
3 Commits
df194be1a0
...
bec78b8405
Author | SHA1 | Date | |
---|---|---|---|
|
bec78b8405 | ||
|
ed5699cd78 | ||
|
be4595bc7e |
BIN
1613725221862.jpg.tmp
Normal file
BIN
1613725221862.jpg.tmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 881 KiB |
72
stopvarnish.yml
Executable file
72
stopvarnish.yml
Executable file
@ -0,0 +1,72 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: True
|
||||
|
||||
tasks:
|
||||
- name: Create conf directory
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/varnish.service.d
|
||||
state: directory
|
||||
mode: '0655'
|
||||
|
||||
- name: Dropping config in conf directory
|
||||
ansible.builtin.template:
|
||||
src: templates/customexec.conf.j2
|
||||
dest: /etc/systemd/system/varnish.service.d/customexec.conf
|
||||
mode: '0655'
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Dropping Varnish config (default.vcl)
|
||||
ansible.builtin.template:
|
||||
src: templates/default.vcl.j2
|
||||
dest: /etc/varnish/default.vcl
|
||||
mode: '0644'
|
||||
force: yes
|
||||
|
||||
- name: Reload daemons, enable varnish
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: yes
|
||||
name: varnish.service
|
||||
enabled: no
|
||||
state: stopped
|
||||
|
||||
- name: Modfying Apache default port
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/apache2/ports.conf
|
||||
regexp: '^Listen 8080$'
|
||||
line: 'Listen 80'
|
||||
|
||||
- name: Find all enabled vhosts
|
||||
ansible.builtin.find:
|
||||
paths: /etc/apache2/sites-available
|
||||
patterns: "*.conf"
|
||||
follow: yes
|
||||
file_type: file
|
||||
register: vhosts
|
||||
|
||||
- name: dbg
|
||||
ansible.builtin.debug:
|
||||
var: vhosts.files
|
||||
|
||||
- name: Modfying VHosts
|
||||
ansible.builtin.replace:
|
||||
path: "{{ item.path }}"
|
||||
regexp: '^\<[Vv]irtual[Hh]ost \*:8080\>$'
|
||||
replace: "<VirtualHost *:80>"
|
||||
with_items:
|
||||
- "{{ vhosts.files }}"
|
||||
|
||||
- name: Activating Apache Headers Mod
|
||||
community.general.apache2_module:
|
||||
state: present
|
||||
name: headers
|
||||
identifier: headers_module
|
||||
|
||||
- name: Restart Varnish and Apache
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item }}"
|
||||
state: restarted
|
||||
with_items:
|
||||
- "apache2.service"
|
||||
|
@ -34,7 +34,7 @@ sub vcl_backend_response {
|
||||
set beresp.ttl = 2h;
|
||||
set beresp.grace = 24h;
|
||||
|
||||
if (bereq.url ~ "\.(bmp|ejs|jpeg|pdf|ps|ttf|class|eot|jpg|pict|svg|webp|html|htm|css|eps|js|pls|svgz|woff|csv|gif|mid|png|swf|woff2|doc|ico|midi|ppt|tif|xls|docx|jar|otf|pptx|tiff|xlsx|mp3)$") {
|
||||
if (bereq.url ~ "\.(bmp|ejs|jpeg|pdf|ps|ttf|class|eot|jpg|pict|svg|webp|html|htm|css|eps|js|pls|svgz|woff|csv|gif|mid|png|swf|woff2|doc|ico|midi|ppt|tif|xls|docx|jar|otf|pptx|tiff|xlsx|php|mp3)$") {
|
||||
set beresp.ttl = 1y;
|
||||
set beresp.grace = 24h;
|
||||
}
|
||||
|
@ -2,7 +2,12 @@
|
||||
- hosts: all
|
||||
become: True
|
||||
|
||||
tasks:
|
||||
tasks:
|
||||
- name: Stop Apache
|
||||
ansible.builtin.systemd:
|
||||
name: apache2
|
||||
state: stopped
|
||||
|
||||
- name: Install Varnish
|
||||
ansible.builtin.package:
|
||||
name: varnish
|
||||
|
Loading…
x
Reference in New Issue
Block a user