Caddy Unable to start as a service on Window server 2008 R2

Some of the built-in Windows accounts do not have access to networking - this is the direction my mind is going.

1 Like

It’s a good thought, but even when Caddy has no networking permissions, it still writes to the process log. The fact that log has no content is what I don’t get in that situation. (Unless it has no networking OR file permissions?)

Uh, I have tried Caddyfile content just “localhost:8080”, it strated. Edit to “example.com {…}” it not start.

Example.com will not resolve to your IP address, so Caddy will be unable to get a certificate. This will, however, be recorded in Caddy’s log - are you sure you’re looking in the right place for the log?

This “example.com” just example. actually using resolve to my host domain. This problem maybe Caddy has no networking permissions.
But I still have no resolution.

Maybe these questions have already been asked, but here goes

  1. Can you start caddy not running as a service eg from cmd line?
  2. Ensure the service is installed with all the following cmd line args
    • ‘-agree’
    • ‘-log c:\afile.log’
    • '-conf “c:\mycaddyfile.caddyfile”

If any of these are missing you cannot debug the issue.

1 Like

@matt @hacdias @tobya

Hi, all.
I testing 2 version Caddy(10.10&10.12) on the Windows server 2003.
The results follows:

Caddy 0.10.10

  • Can start using “Caddy -conf /path/to/caddyfile -log /path/to/log.log” from cmd line
  • Can create a service and start using “Caddy -service install -conf /path/to/caddyfile -log /path/to/log.log”
  • Can’t start from cmd line and windows service using “Caddy -service install -agree -conf /path/to/caddyfile -log /path/to/log.log”

Caddy 0.10.12

  • Can start using “Caddy -conf /path/to/caddyfile -log /path/to/log.log” from cmd line
  • Can create a service using “Caddy -service install -conf /path/to/caddyfile -log /path/to/log.log”, But can’t start service.
  • Can’t start from cmd line and windows service using “Caddy -service install -agree -conf /path/to/caddyfile -log /path/to/log.log”

And I’ve recorded a video for my testing.

May be Caddy’s(new versions) bug? or hook.server plugin bug?
If anyone would like to try, I can provide my Windows server.

This is my problem:
https://caddy.community/t/nextcloud-php-errors/3653/3?u=xincun
I found caddy unable to start php-cgi.exe. Inspired by the upper floors, I testing 2 version the same (10.10&10.12) on win7x64.

caddy10.10 and php7.2.4:
When caddy starts, php-cgi.exe starts at the same time. Everything is OK.

caddy10.12 and php7.2.4:
When caddy starts, php-cgi.exe does not running.

The same environment, the same config.

@matt, @Whitestrake

What is your Caddyfile, exactly?

https://caddy.community/t/nextcloud-php-errors/3653/3?u=xincun

Plz testing. From examples.

What is your full, unedited, unredacted Caddyfile?

https://caddy.community/t/nextcloud-php-errors/3653?u=xincun
As I said in my post, this caddyfile successfully started php once and then it never started successfully.
With the help of Whitestrake, the original problem should be the folder permissions issues instead of starting PHP issues.

caddy10.14 does not pull up php-cgi.exe.

Oh, it seems to be related to this issue. It will be solved asap. :slight_smile:

1 Like

@html we just updated hook.service. Could you try downloading it again?

1 Like

Wow, This problem has been solved. Is awesome. :yum:
Thank you, Hacdias!

1 Like

Did you reproduce this problem? How to solve caddy not being able to wake up php-cgi.

There is currently an issue with the service plugin and caddy. The service plugin prevents any on startup commands from running.

@hacdias may have updated the plugin by now, so if you download caddy with plugins again it may work,

1 Like

I would like to inform I got this error on windows 10.
No log file would be generated.
The error in the System Event log was “The Caddy service terminated with the following service-specific error:
Incorrect function.”
What helped for me was changing this
caddy -service install -conf C:\caddy\Caddyfile -log C:\caddy\caddy.log
to this
caddy -service install -conf C:\caddy\Caddyfile -log C:\caddy\caddy.log -agree -email email@example.com

Both -agree and -email seem to be needed.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.