Files
michaelschiemer/deployment/ansible/playbooks/test-fastcgi-directly.yml

47 lines
1.9 KiB
YAML

---
- name: Test FastCGI Connection Directly
hosts: production
gather_facts: yes
become: no
tasks:
- name: Install cgi-fcgi in nginx container and test FastCGI
shell: |
cd ~/deployment/stacks/staging
echo "=== Test FastCGI with a simple request ==="
# Create a simple test script
docker compose exec -T staging-nginx sh -c "echo -e 'REQUEST_METHOD=GET\nSCRIPT_FILENAME=/var/www/html/public/index.php\nSERVER_NAME=test\n' > /tmp/fcgi-test.txt && cat /tmp/fcgi-test.txt" || echo "Could not create test file"
echo ""
echo "=== Check nginx error log directly ==="
docker compose exec -T staging-nginx tail -100 /var/log/nginx/error.log 2>&1 || echo "Error log not found at /var/log/nginx/error.log"
echo ""
echo "=== Check nginx access log ==="
docker compose exec -T staging-nginx tail -50 /var/log/nginx/access.log 2>&1 | tail -20 || echo "Access log not found"
args:
executable: /bin/bash
register: fcgi_test
ignore_errors: yes
failed_when: false
- name: Display FastCGI test results
debug:
msg: "{{ fcgi_test.stdout_lines }}"
- name: Make a real HTTP request and capture full response
shell: |
cd ~/deployment/stacks/staging
echo "=== Make HTTP request from nginx container ==="
docker compose exec -T staging-nginx curl -v http://127.0.0.1/ 2>&1 || echo "Request failed"
echo ""
echo "=== Check what nginx sees ==="
docker compose exec -T staging-nginx sh -c "timeout 2 tail -f /var/log/nginx/error.log 2>&1 & sleep 1 && curl -s http://127.0.0.1/ > /dev/null && sleep 1" || echo "Log check failed"
args:
executable: /bin/bash
register: http_test
ignore_errors: yes
failed_when: false
- name: Display HTTP test results
debug:
msg: "{{ http_test.stdout_lines }}"