Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example vhost for caddy webserver #733

Open
alexander-schranz opened this issue Aug 3, 2022 · 0 comments
Open

Add example vhost for caddy webserver #733

alexander-schranz opened this issue Aug 3, 2022 · 0 comments

Comments

@alexander-schranz
Copy link
Member

alexander-schranz commented Aug 3, 2022

The caddy webserver is more and more common. Even deployer is using it in its new deployment feature where it actually will install caddy webserver and php on a blank ubuntu server when activated in deployment.

So it would be really nice to have caddy vhost which works the same as nginx: https://docs.sulu.io/en/latest/cookbook/web-server/nginx.html

Important mechanisms of the VHost

Check for static files fallback to index.php

Sulu generates thumbnails the first time they are requested, so a fallback mechanism is required. In nginx this is achieved via:

    location / {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;
    }

Static files cachelifetime

Static files will have a specified cachelifetime in nginx:

   location ~* \.(?:ico|css|js|gif|webp|jpe?g|png|svg|woff|woff2|eot|ttf|mp4)$ {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;
        access_log off;
        expires 1y;
        add_header Pragma public;
        add_header Cache-Control "public, immutable";
    }

This will mostly be the biggest difference to Symfony caddy configuration. Currently there is not yet any official symfony caddy vhost: symfony/symfony-docs#17471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant