Compare commits

...

3 Commits

Author SHA1 Message Date
ec0a1adc01 Added php to nginx-webserver 2022-03-10 09:47:12 +01:00
5108efea23 Converted nginx-webserver index.html to php 2022-03-10 08:55:57 +01:00
b80bd3e913 Added shebang to install_deps.sh 2022-03-10 08:55:36 +01:00
5 changed files with 46 additions and 8 deletions

View File

@ -1 +1,2 @@
sudo apt-get -y install virtualbox vagrant ansible
#!/usr/bin/env bash
sudo apt-get -y install virtualbox vagrant ansible

View File

@ -1,6 +1,6 @@
---
# handlers file for nginx-webserver
- name: restart nginx
- name: reload nginx
ansible.builtin.service:
name: nginx
state: restarted

View File

@ -1,14 +1,35 @@
---
# tasks file for nginx-webserver
- name: Install nginx
- name: Install nginx and php
package:
name: nginx
name:
- nginx
- php7.4
- php7.4-fpm
- php7.4-cli
state: present
update_cache: yes
become: true
notify: restart nginx
- name: Copy over index.html
- name: Copy over nginx.conf
ansible.builtin.template:
src: ./templates/index.html.j2
dest: /var/www/html/index.html
src: ./templates/nginx.cfg.j2
dest: /etc/nginx/sites-available/nginx.cfg
become: true
notify: reload nginx
- name: Enable nginx.conf
file:
src: /etc/nginx/sites-available/nginx.cfg
dest: /etc/nginx/sites-enabled/default
state: link
become: true
notify: reload nginx
- name: Remove nginx default crap
file:
state: absent
path: /var/www/html/*
become: true
- name: Copy over index.php
ansible.builtin.template:
src: ./templates/index.php.j2
dest: /var/www/html/index.php
become: true

View File

@ -8,6 +8,7 @@
</head>
<body>
<h1><?php echo 'Hello, World!'; ?></h1>
<p>Hostname: {{ ansible_facts.nodename }}</p>
<p>OS: {{ ansible_facts.distribution }} {{ ansible_facts.distribution_version }}</p>
<p>Kernel: {{ ansible_facts.kernel }}</p>

View File

@ -0,0 +1,15 @@
server {
listen 80;
root /var/www/html;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}