上QQ阅读APP看书,第一时间看更新
Installing PHP for WordPress setup
The following code snippet uses different modules to perform the installation of PHP and other required packages. Then it updates the PHP-FPM configuration using the replace module. Finally, it also updates the nginx configuration to update the PHP-FPM processing using the template module, and restarts the service to apply the changes:
- name: installing php
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- php
- php-curl
- php-fpm
- php-mysql
- php-xmlrpc
- name: configuring php.ini for php processor
replace:
path: /etc/php5/fpm/php.ini
regex: ';cgi.fix_pathinfo=1'
replace: 'cgi.fix_pathinfo=0'
backup: yes
- name: enable and restart the php fpm service
service:
name: php7.0-fpm
enabled: yes
state: restarted
- name: update the nginx configuration to support php-fpm
template:
src: "{{ item.src }}"
dest: "{{ item.dst }}"
with_items:
- { src: "defautlt.conf.j2", dst: "/etc/nginx/conf.d/default.conf" }
- name: restart the nginx
service:
state: restarted
name: nginx