caddy-docker icon indicating copy to clipboard operation
caddy-docker copied to clipboard

PHP variant & localhost

Open Algedi13 opened this issue 7 years ago • 4 comments

Hello,

I have trouble setting up caddy in php.

Caddy conf :

	on startup php-fpm7
	fastcgi / 127.0.0.1:9000 php {
		root /srv/www
		index index.html index.htm index.php
	}

Edit : It was a bad compilation that was settled.

Algedi13 avatar Mar 21 '18 09:03 Algedi13

share the entire Caddyfile

abiosoft avatar Mar 21 '18 09:03 abiosoft

Thanks it was a bad compilation that was settled. Now I'm getting :

2018/03/21 09:53:49 [INFO] Blocking Command "php-fpm7 " with ID ...                                                                                                                                                                            
2018/03/21 09:53:50 http: TLS handshake error from 10.0.3.1:38798: tls: first record does not look like a TLS handshake

Algedi13 avatar Mar 21 '18 10:03 Algedi13

Kindly share the entire Caddyfile, you can mask the parts that are private if required. That error has to do with your server name/port configuration.

abiosoft avatar Mar 21 '18 10:03 abiosoft

Ok here is :

    [mydomain]:443 {
	log stdout
	errors stdout
	gzip
	on startup php-fpm7
        fastcgi / 127.0.0.1:9000 php
        root /srv/www
        tls /root/.caddy/domain.full.cert.pem /root/.caddy/domain.key

	header / {
		Strict-Transport-Security "max-age=31536000;"
		X-XSS-Protection "1; mode=block"
		X-Content-Type-Options "nosniff"
		X-Frame-Options "DENY"
		Content-Security-Policy ""
		Referrer-Policy "strict-origin-when-cross-origin"
                -Server
	}
}

index.php (php info) in /srv/www

I get a 404 error

10.0.3.1 - - [21/Mar/2018:10:10:13 +0000] "GET / HTTP/2.0" 404 38

By doing netstat -an | grep: 9000 no listen on port.

Edit : I rebuild with network_mode: host and netstat -an | grep: 9000 is ok but always errors :


2018/03/22 18:17:03 [INFO] Blocking Command "php-fpm7 " with ID ...
22/Mar/2018:18:17:41 +0000 [ERROR 0 /] Primary script unknown                                                                                                                                                                                                                   
[my ip] - - [22/Mar/2018:18:17:41 +0000] "GET / HTTP/2.0" 404 54

On [mydomain] i have "File not found"

Algedi13 avatar Mar 21 '18 10:03 Algedi13