caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
55.71k stars 3.92k forks source link

Identical http.on command executed more than once on Windows 7 x64 #2333

Closed magikstm closed 5 years ago

magikstm commented 5 years ago

1. What version of Caddy are you using (caddy -version)?

Caddy 0.11.0 (non-commercial use only)

2. What are you trying to do?

Use PHP with Caddy on Windows 7 x64.

3. What is your entire Caddyfile?

:2015 {
    root E:\caddy2\caddySites
    on startup E:\caddy2\php\php-cgi.exe -b 6545 &
    fastcgi / 127.0.0.1:6545 {
        ext .php
    }
}

:2018 {
    root E:\caddy2\caddySites
    on startup E:\caddy2\php\php-cgi.exe -b 6545 &
    fastcgi / 127.0.0.1:6545 {
        ext .php
    }
}

4. How did you run Caddy (give the full command and describe the execution environment)?

I double-clicked caddy.exe.

5. Please paste any relevant HTTP request(s) here.

None.

6. What did you expect to see?

A single instance of php-cgi.exe running.

7. What did you see instead (give full error messages and/or log)?

Two instances of php-cgi.exe running.

This doesn't respect docs about http.on (https://caddyserver.com/docs/on) :

A command will only be executed once for each time it appears in the Caddyfile. 
In other words, even if this directive is shared by more than one host, 
a command will only execute once per appearance in the Caddyfile. 

8. How can someone who is starting from scratch reproduce the bug as minimally as possible?

Download Caddy personal and execute with this minimal caddyfile.

mholt commented 5 years ago

Thanks for filling out the issue template.

This is working as intended. The on directive you are referring to appears twice in the Caddyfile. It will only appear once if you combine the two sites under the same definition: :2015, :2018 {.

magikstm commented 5 years ago

Oh. I tested as you suggested and it works.

I would suggest adjusting this part of the doc to something like this: A command will only be executed once if shared by more than one site under the same definition.

I find the current wording a bit misleading.