Wordpress download / Vhost config
This commit is contained in:
parent
2d6606c0a4
commit
009993e3a0
39
roles/configure-nginx/files/vhost.conf.j2
Normal file
39
roles/configure-nginx/files/vhost.conf.j2
Normal file
@ -0,0 +1,39 @@
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
text/html epoch;
|
||||
text/css max;
|
||||
application/javascript max;
|
||||
~image/ max;
|
||||
}
|
||||
|
||||
server {
|
||||
root /var/www/{{ vhost_name }};
|
||||
index index.php index.html index.htm;
|
||||
server_name {{ domain }};
|
||||
listen 80;
|
||||
|
||||
expires $expires;
|
||||
client_max_body_size 50M;
|
||||
|
||||
autoindex off;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ @handler;
|
||||
}
|
||||
|
||||
location /admin {
|
||||
try_files $uri $uri/ /admin/index.php?$args;
|
||||
}
|
||||
|
||||
location @handler {
|
||||
if (!-e $request_filename) { rewrite / /index.php last; }
|
||||
rewrite ^(.*.php)/ $1 last;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php{{ php_version }}-fpm.sock;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
---
|
||||
- name: Create wwwroot
|
||||
file:
|
||||
path: /var/www/{{ vhost_name }}
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Prepare config file
|
||||
copy:
|
||||
src: files/web-{{ vhost_name }}.conf
|
||||
template:
|
||||
src: files/vhost.conf.j2
|
||||
dest: /etc/nginx/sites-available/web-{{ vhost_name }}.conf
|
||||
|
||||
- name: Create a symbolic link
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
- name: Start PHP
|
||||
systemd:
|
||||
name: "{{ item }}"
|
||||
name: "php{{ php_version }}-fpm"
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: started
|
||||
|
17
roles/install-wordpress/main.yml
Normal file
17
roles/install-wordpress/main.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Download latest WP
|
||||
get_url:
|
||||
url: https://wordpress.org/latest.zip
|
||||
dest: /var/www/{{ vhost_name }}
|
||||
mode: '0660'
|
||||
|
||||
- name: Extract wordpress
|
||||
unarchive:
|
||||
src: /var/www/{{ vhost_name }}/latest.zip
|
||||
dest: /var/www/{{ vhost_name }}
|
||||
remote_src: yes
|
||||
|
||||
- name: Delete the wordpress zip
|
||||
file:
|
||||
state: absent
|
||||
path: /var/www/{{ vhost_name }}/latest.zip
|
@ -11,3 +11,4 @@
|
||||
- role: configure-nginx
|
||||
- role: install-php
|
||||
- role: configure-php
|
||||
- role: install-wordpress
|
@ -1,4 +1,5 @@
|
||||
---
|
||||
php_version: 8.1
|
||||
password: magic
|
||||
vhost_name: projectwp
|
||||
domain: projectwp.com
|
||||
db_pwd: 123456
|
Loading…
Reference in New Issue
Block a user