From 9e148c79654ff599f7ab96accc3fbf1765b946df Mon Sep 17 00:00:00 2001 From: Lulzette Date: Sat, 1 Jan 2022 04:16:10 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20pl?= =?UTF-8?q?aybook=20=D0=B4=D0=BB=D1=8F=20=D1=83=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B8=20=D0=BA=D0=BE=D0=BD=D1=84?= =?UTF-8?q?=D0=B8=D0=B3=D1=83=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20nginx+=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/nginx.conf | 71 ++++++++++++++++++++++++++++++++++++++++ playbook.yml | 37 +++++++++++++++++++++ basic.sh => src/basic.sh | 0 3 files changed, 108 insertions(+) create mode 100644 files/nginx.conf create mode 100644 playbook.yml rename basic.sh => src/basic.sh (100%) diff --git a/files/nginx.conf b/files/nginx.conf new file mode 100644 index 0000000..ea699cb --- /dev/null +++ b/files/nginx.conf @@ -0,0 +1,71 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + + + ## + # Virtual Host Configs + ## + + server { + listen 80 default_server; + listen [::]:80 default_server; + + root /var/www; + + index index.html index.htm; + + server_name _; + + location / { + try_files $uri $uri/ =404; + } + + } +} + + diff --git a/playbook.yml b/playbook.yml new file mode 100644 index 0000000..e7a9ce5 --- /dev/null +++ b/playbook.yml @@ -0,0 +1,37 @@ +--- +- hosts: localhost + connection: local + tasks: + - name: Install nginx + become: yes + apt: + name: nginx-light + update_cache: yes + state: latest + - name: Create dir + file: + path: /var/www + state: directory + - name: Copy repo files + become: yes + copy: + src: "{{ item }}" + dest: /var/www + owner: www-data + group: www-data + with_fileglob: + - src/* + - name: Copy config file + become: yes + copy: + src: files/nginx.conf + dest: /etc/nginx/nginx.conf + owner: root + notify: + - Reload nginx + handlers: + - name: Reload nginx + become: yes + service: + name: nginx + state: restarted diff --git a/basic.sh b/src/basic.sh similarity index 100% rename from basic.sh rename to src/basic.sh