HTTPS for WordPress using Caddy

Caddy equivalent code for specific sections of the WordPress support article HTTPS for WordPress.

Best Practices for HTTPS for WordPress #

The Caddy web server activates HTTPS by default for qualifying domain names and automatically enables HTTP → HTTPS redirects. By default, it obtains certificates from Let’s Encrypt and renews them automatically. { 
    # Set this path to your site's directory:
    root * /var/www/html

    # Enable Gzip compression:
    encode gzip

    # Serve WordPress PHP files through php-fpm:
    php_fastcgi unix//run/php/php7.4-fpm.sock

    # Enable the static file server:

:writing_hand: Depending on your PHP-FPM config, the php_fastcgi can also be php_fastcgi

Credits and References


@francislavoie for his contributions within the development reference.


  1. HTTPS for WordPress
  2. Development: HTTPS for WordPress using Caddy