Jump to content

Caddy - a lightweight HTTP2 web server


gurkendoktor
 Share

Recommended Posts

With php7 I don't see any reason why one would run hhvm besides at enterprice scale. Without 100% feature parity to php using hhvm is trading a spark more speed for the potential of having unexpected issues, which are probably hard to debug/reason about.

Link to comment
Share on other sites

  • 4 years later...

Hello wonderful Caddyphiles,

Do any of you have an updated config for PW and Caddy?  I wouldn't mind trying this out now Caddy has matured somewhat. Never run it before though so will start acquainting myself with the docs.

  • Like 1
Link to comment
Share on other sites

Here is my Caddy 2 config for a PW site:
 

mysite.fi, www.mysite.fi {
    encode gzip
    tls my@email.com
    root * /var/www/mysite/pw
    file_server

    php_fastcgi unix//var/run/php-fpm/php-fpm.sock {
        health_timeout 10000s
    }

    @deny_hidden path_regexp /\.
    @deny_root path_regexp /(CONTRIBUTING|COPYRIGHT|LICENSE|README|htaccess)\.txt
    @deny_assets path_regexp ^/site(-[^/]+)?/assets/(.*\.php|backups|cache|config|install|logs|sessions)
    @deny_install path_regexp ^/site(-[^/]+)?/install
    @deny_config path_regexp ^/(site(-[^/]+)?|wire)/(config(-dev)?|index\.config)\.php
    @deny_modules path_regexp ^/((site(-[^/]+)?|wire)/modules|wire/core)/.*\.(inc|module|php|tpl)
    @deny_templates path_regexp ^/(site(-[^/]+)?|wire)/templates(-admin)?/.*\.(inc|html?|php|tpl)

    rewrite @deny_hidden /denyaccess
    rewrite @deny_root /denyaccess
    rewrite @deny_assets /denyaccess
    rewrite @deny_install /denyaccess
    rewrite @deny_config /denyaccess
    rewrite @deny_modules /denyaccess
    rewrite @deny_templates /denyaccess

    # global rule
    try_files {path} {path}/ /index.php?it={path}&{query}

    log {
        format single_field common_log
        output file /var/log/www/access.log {
            roll_size      50MiB
            roll_keep      5
            roll_keep_for  168h
        }
    }
}

 

  • Like 5
  • Thanks 2
Link to comment
Share on other sites

  • 2 years later...

I've been using Apache forever... never even touched nginx.  Today I felt like giving Caddy a try and it feels nice.

I developed what I believe is a much more improved Caddyfile that also supports ProCache and stronger blocking of files (returns a 403 like PW's htaccess file, instead of a 404 which is what /denyaccess seems to do).  I added a way to also put the site in maintenance mode (meaning all requests get rewritten to /maintenance.php) if /maintenance.php exists (which is now part of my deployment process).

Hopefully I can share the results in a week.

  • Like 5
Link to comment
Share on other sites

7 hours ago, Jonathan Lahijani said:

I added a way to also put the site in maintenance mode (meaning all requests get rewritten to /maintenance.php) if /maintenance.php exists (which is now part of my deployment process).

RockMigrations has a checkbox to prevent guest access. What you state hear sounds interesting. What do you think of adding that to RockMigrations?

  • Like 1
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...