Dies ist eine alte Version des Dokuments!
Proxmox container 'wordpress.test'
Status
- testing …
Container setup
- image: debian10 with users
- 1. Netzwerkinterface
- eth0
- 10.2.0.30/24 DG: 10.2.0.254; fd00:10:2:0::30/64 DGfd00:10:2:0::0
- bridge: vmbr0
- 2. Netzwerkinterface:
- eth1,
- 10.3.0.30/24; fd00:10:3:0::30/64
- bridge: vmbr1
Ansible setup
- verbindet man sich als unpriviligierter user und möchte ein Command als ein anderer, unpriviligierter user ausführen (z.B. www-data), benötigt man
allow_world_readable_tmpfiles = yes
in der ansible.cfg, damit dies nicht als Fehler zum Abbruch führt.
Ansible Script
#!/usr/bin/env ansible-playbook
- name: 'install nextcloud'
hosts: wordpress
become: true
tasks:
- name: remove apache2
apt:
name: apache2
state: absent
- name: install packages
apt:
pkg:
- php7.3
- php7.3-xml
- php7.3-mbstring
- php7.3-zip
- php7.3-mysql
- php7.3-imagick
- nginx
- name: check if nextcloud is already installed
stat:
path: /var/www/wordpress
register: wordpress_exists
- name: Download wordpress and unpack
unarchive:
src: https://wordpress.org/latest.zip
dest: /var/www
owner: www-data
group: www-data
remote_src: yes
when: not wordpress_exists.stat.exists
- name: Remove file packed file
file:
path: /var/www/latest.zip
state: absent
- name: copy nginx config
copy:
src: ./conf/wordpress.conf
dest: /etc/nginx/sites-available/
owner: root
group: root
mode: '0744'
- name: Create a symbolic link
file:
src: /etc/nginx/sites-available/wordpress.conf
dest: /etc/nginx/sites-enabled/wordpress.conf
owner: root
group: root
state: link
- name: load php-fpm
systemd:
state: restarted
name: php7.3-fpm
- name: Restart nginx
systemd:
state: restarted
daemon_reload: yes
name: nginx
Notizen
NGINX Config
server {
listen 8086;
listen [::]:8086;
root /var/www/wordpress;
index index.php index.html index.htm;
server_name bytecluster0007.bytsepeicher.org;
error_log /var/log/nginx/wordpress.log;
access_log /var/log/nginx/wordpress.log;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}