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