fix: use nginx for php fpm

This commit is contained in:
2023-01-16 23:49:09 +01:00
parent 269f2787b6
commit 13174053f1
2 changed files with 26 additions and 3 deletions

View File

@@ -63,10 +63,11 @@
working_dir: /var/www/
when: not project_stat.stat.exists
- name: Install php-fpm
- name: Install php-fpm & nginx
apt:
pkg:
- php-fpm
- nginx
- name: Configure php-fpm listen
lineinfile:
@@ -78,12 +79,19 @@
lineinfile:
path: /etc/php/8.1/fpm/pool.d/www.conf
regex: ^listen = .*$
line: listen = 0.0.0.0:8080
line: listen = 0.0.0.0:9000
notify: restart php-fpm
- name: Configure php-fpm listen allowed clients
lineinfile:
path: /etc/php/8.1/fpm/pool.d/www.conf
regex: ^;*listen.allowed_clients = .*$
line: listen.allowed_clients = 192.168.122.1
#line: listen.allowed_clients = 192.168.122.1
line: listen.allowed_clients = 127.0.0.1
notify: restart php-fpm
- name: Configure nginx
template:
src: default-nginx.conf
dest: /etc/nginx/sites-available/default
notify: restart nginx

View File

@@ -0,0 +1,15 @@
server {
listen 8080;
index index.php index.html;
root /var/www/html/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}