Skip to main content

PHP et caddy

INSTALL

On a besoin de php-fpm et caddy

Dans le fichier de conf /etc/php-fpm.d/www.conf, verifier que

listen.acl_users = apache,nginx,caddy

et

user = caddy
; RPM: Keep a group allowed to write in log dir.
group = caddy

La conf caddy

Ici on prend comme exemple un nom de domaine "test.ppsfleet.navy"

  • creer le fichier /etc/caddy/Caddyfile.d/test.ppsfleet.navy.conf avec
test.ppsfleet.navy {

    # Set this path to your site's directory.
    root * /srv/www/test.ppsfleet.navy

    php_fastcgi unix//run/php-fpm/www.sock 

    # Another common task is to set up a reverse proxy:
    # reverse_proxy localhost:8080

    # Or serve a PHP site through php-fpm:
    # php_fastcgi localhost:9000

    # Refer to the directive documentation for more options.
    # https://caddyserver.com/docs/caddyfile/directives

}
  • Autoriser php a executer des scripts dans le dossier
chown -R caddy:caddy /srv/www/test.ppsfleet.navy/
semanage fcontext -a -t httpd_sys_script_exec_t '/srv/www/test.ppsfleet.navy(/.*)?'
restorecon -Rv /srv/www/test.ppsfleet.navy/