From 13174053f12eab70db94859dd4a3dbb9e14132f7 Mon Sep 17 00:00:00 2001 From: Sheppy Date: Mon, 16 Jan 2023 23:49:09 +0100 Subject: [PATCH] fix: use nginx for php fpm --- roles/typo3-cms/tasks/main.yaml | 14 +++++++++++--- roles/typo3-cms/templates/default-nginx.conf | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 roles/typo3-cms/templates/default-nginx.conf diff --git a/roles/typo3-cms/tasks/main.yaml b/roles/typo3-cms/tasks/main.yaml index 215b20f..9952c1c 100644 --- a/roles/typo3-cms/tasks/main.yaml +++ b/roles/typo3-cms/tasks/main.yaml @@ -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 diff --git a/roles/typo3-cms/templates/default-nginx.conf b/roles/typo3-cms/templates/default-nginx.conf new file mode 100644 index 0000000..6359f1b --- /dev/null +++ b/roles/typo3-cms/templates/default-nginx.conf @@ -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; + } +}