SteveLTN / https-portal

A fully automated HTTPS server powered by Nginx, Let's Encrypt and Docker.
MIT License
4.42k stars 296 forks source link

PHP-FPM/Fast-CGI Support #277

Closed konstantine-v closed 3 years ago

konstantine-v commented 3 years ago

I'm able to get the wordpress site working on the base apache default but I cannot get the php-fpm implementation working even after adding the fastcgi params in the nginx config. I'm not sure what I'm missing, but is there support for php-fpm in https-portal and I'm just missing it?

My Dockerfile

version: '3'
services:
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - 80:80
      - 443:443
    links:
      - wp
    restart: always
    environment:
      DOMAINS: 'example.com -> http://wp:9000'
      STAGE: staging
    volumes:
      - ./public_html:/var/www/html
      - https-portal-data:/var/lib/https-portal
      - ./nginx-conf/example.site.com.ssl.conf:/var/lib/nginx-conf/example.site.com.ssl.conf.erb:ro
    networks:
      - app-network
  wp:
    build: .
    restart: always
    container_name: wp
    ports:
      - 9000:9000
    environment:
      WORDPRESS_DB_HOST: host:porst
      WORDPRESS_DB_NAME: name
      WORDPRESS_DB_USER: user
      WORDPRESS_DB_PASSWORD: pass
      WORDPRESS_TABLE_PREFIX: wp
    volumes:
      - ./public_html:/var/www/html
      - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
      - ./php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf
    networks:
      - app-network

volumes:
  wp:
  https-portal-data:

networks:
  app-network:
    driver: bridge

The names and values in the yml file were changed, with the correct values I'm able to get it working, but when I use the fpm version I get recv() failed (104: Connection reset by peer) while reading response header from upstream

I'm building the wordpress image from wordpress:5.7.0-php7.4-fpm-alpine in the Dockerfile along with some other custom configurations, which shouldn't affect nginx as far as I'm aware.

Thanks,

SteveLTN commented 3 years ago

HTTPS-PORTAL does not care about fpm or Apache. It simply forwards the incoming request. Did you get the same Wordpress setting running without HTTPS-PORTAL?

konstantine-v commented 3 years ago

I'm able to get the wordpress settings working on Apache but getting the connection reset when using FPM. It may be an issue with the wordpress setup I presume.

SteveLTN commented 3 years ago

HTTPS-PORTAL doesn't care whether you use Apache or FPM. I recommend you to fix FPM first then put HTTPS-PORTAL on top. Or, just use Apache version of Wordpress and put HTTPS-PORTAL on top.