Followed the guide for Caddy and nothing works. #32

Closed
opened 2024-08-16 17:43:34 +00:00 by blit · 10 comments

I use Arch btw.

Installed PHP packages:

  • php-legacy
  • php-legacy-apcu
  • php-legacy-fpm
  • php-legacy-imagick

Main page works
image

Instance browser page works, but there's no successful requests.
image

Search doesn't work
image
image

My Caddyfile:
image

**I use Arch btw.** Installed **PHP** packages: - **php-legacy** - **php-legacy**-apcu - **php-legacy**-fpm - **php-legacy**-imagick Main page works ![image](/attachments/7b429116-8a25-4062-92fa-f2b53d301fc9) Instance browser page works, but there's no successful requests. ![image](/attachments/e479a81f-0810-4f6b-998c-fd2c812a7063) Search doesn't work ![image](/attachments/1852a97a-26fc-429d-9eb2-037085dc694d) ![image](/attachments/8ebb14d6-6655-4c68-aefe-474f8c5a4c1b) My Caddyfile: ![image](/attachments/6a19ce06-bde9-41f1-af90-b935aabad058)
Owner

any error logs?

any error logs?
Author

any error logs?

Where can I get them?

As I see, there are no any logs in /var/log or anywhere else.

image

> any error logs? Where can I get them? As I see, there are no any logs in /var/log or anywhere else. ![image](/attachments/f84dd909-96a0-4b8b-a587-ba8fbc541223)
Owner

Please setup logging rules

https://caddyserver.com/docs/caddyfile/directives/log

and tell me if it logs any PHP errors. From there I will be able to help you

Please setup logging rules https://caddyserver.com/docs/caddyfile/directives/log and tell me if it logs any PHP errors. From there I will be able to help you
Owner

Closing as I didn't get any feedback from OP

Closing as I didn't get any feedback from OP
Contributor

I'd like to expand on this, since I'm having a similar issue; 4get acting weird. It most likely is something about the Caddyfile, but yeah. Nginx works fine, but when it comes to Caddy it just throws a blank page and a prompt to download if web?s= is present in the URL.

Here's the file:

:port {
    root * /var/www/4g
	file_server
	encode gzip
	php_fastcgi /var/run/php-fpm/php-fpm.sock {
        	index index.php
	}
	redir /{path}.php{query} 301
	try_files {path} {path}.php
}

port is, well, a port.

<abbr title="also that was so rude… #willoverparty">I'd like to expand on this</abbr>, since I'm having a similar issue; 4get acting weird. It most likely is something about the Caddyfile, but yeah. Nginx works fine, but when it comes to Caddy it just throws a blank page and a prompt to download if `web?s=` is present in the URL. Here's the file: ```sh :port { root * /var/www/4g file_server encode gzip php_fastcgi /var/run/php-fpm/php-fpm.sock { index index.php } redir /{path}.php{query} 301 try_files {path} {path}.php } ``` `port` is, well, a port.
Contributor

Log:

http.log.access.log0	handled request	{"request": {"remote_ip": "127.0.0.1", "remote_port": "55076", "client_ip": "127.0.0.1", "proto": "HTTP/1.1", "method": "GET", "host": "4g.stelladenihil.i2p", "uri": "/", "headers": {"X-I2p-Desthash": ["aUlGu28qD1IUUouojs0mhVkgLk7Mj0AQXC3-gTmYQv0="], "Upgrade-Insecure-Requests": ["1"], "Referer": ["/web?s=test&scraper=ddg&nsfw=yes"], "Connection": ["close"], "User-Agent": ["MYOB/6.66 (AN/ON)"], "Dnt": ["1"], "X-I2p-Destb32": ["nfeuno3pfihvefcsroui5tjgqvmsalsozshuaec4fx7icomyil6q.b32.i2p"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,image/png,image/svg+xml,*/*;q=0.8"], "X-I2p-Destb64": ["suHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbK1NPod3I3V557HQRs5ON79VZtDSNEPeDZjCQ~S3zQ5BQAEAAcAAA=="], "Accept-Encoding": ["gzip, deflate"]}}, "bytes_read": 0, "user_id": "", "duration": 0.000144134, "size": 0, "status": 404, "resp_headers": {"Server": ["Caddy"]}}
Log: ```json http.log.access.log0 handled request {"request": {"remote_ip": "127.0.0.1", "remote_port": "55076", "client_ip": "127.0.0.1", "proto": "HTTP/1.1", "method": "GET", "host": "4g.stelladenihil.i2p", "uri": "/", "headers": {"X-I2p-Desthash": ["aUlGu28qD1IUUouojs0mhVkgLk7Mj0AQXC3-gTmYQv0="], "Upgrade-Insecure-Requests": ["1"], "Referer": ["/web?s=test&scraper=ddg&nsfw=yes"], "Connection": ["close"], "User-Agent": ["MYOB/6.66 (AN/ON)"], "Dnt": ["1"], "X-I2p-Destb32": ["nfeuno3pfihvefcsroui5tjgqvmsalsozshuaec4fx7icomyil6q.b32.i2p"], "Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,image/png,image/svg+xml,*/*;q=0.8"], "X-I2p-Destb64": ["suHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbLhxdQKB50TbRLIzr4fUyMbj9EmUS6FtjrAicFzLzhNsuHF1AoHnRNtEsjOvh9TIxuP0SZRLoW2OsCJwXMvOE2y4cXUCgedE20SyM6-H1MjG4~RJlEuhbY6wInBcy84TbK1NPod3I3V557HQRs5ON79VZtDSNEPeDZjCQ~S3zQ5BQAEAAcAAA=="], "Accept-Encoding": ["gzip, deflate"]}}, "bytes_read": 0, "user_id": "", "duration": 0.000144134, "size": 0, "status": 404, "resp_headers": {"Server": ["Caddy"]}} ```
Owner
@cynic

@cynic

i'm not a caddy guy, but with the described behavior my IT monkey debug procedure would be

  • what happens if you download when it prompts you? if it's the .php file your fpm is fucked one way or another, i bet

  • what happens if you make requests to the actual php endpoints? e.g. /web.php. if that works but the other thing doesn't, i guess your redirect is blowing it somehow?

  • i presume the index loads fine? if not make sure the root is correct

  • it looks like the config 301s /web to /web.php? this isn't really a config error but it is an interesting difference between the sample configs, now that i look at them.

    • apache passes /x to /x.php internally but doesn't care if you hit /x.php directly
    • nginx passes /x to /x.php internally but does 301 you to /x if you try to hit /x.php
    • caddy seemingly just 301s everything to /x.php

probably not helpful but 's all i got on short notice. if you can't get it figured out hit up diowo, i think he wrote this caddy config originally. shoutout nginx, ain't never let me down.

> @cynic i'm not a caddy guy, but with the described behavior my IT monkey debug procedure would be * what happens if you download when it prompts you? if it's the .php file your fpm is fucked one way or another, i bet * what happens if you make requests to the actual php endpoints? e.g. /web.php. if that works but the other thing doesn't, i guess your redirect is blowing it somehow? * i presume the index loads fine? if not make sure the root is correct * it looks like the config 301s /web to /web.php? this isn't really a config error but it is an interesting difference between the sample configs, now that i look at them. * apache passes /x to /x.php internally but doesn't care if you hit /x.php directly * nginx passes /x to /x.php internally but *does* 301 you to /x if you try to hit /x.php * caddy seemingly just 301s everything to /x.php probably not helpful but 's all i got on short notice. if you can't get it figured out hit up diowo, i think he wrote this caddy config originally. shoutout nginx, ain't never let me down.
Contributor

alright, for some reason, it works but only if you go to /index.php first

and no, the plain url is 404, but appears as a blank page if using firefox-based browsers, for chromium it just straight up shows 404

my guess here is that the index is set wrong, but i could be wrong

alright, for some reason, it works but only if you go to `/index.php` first and no, the plain url is 404, but appears as a blank page if using firefox-based browsers, for chromium it just straight up shows 404 my guess here is that the index is set wrong, but i could be wrong
Contributor

4got to update,

The fix I found was to set

try_files {path} {path}.php

to

try_files {path} {path}.php  index.php

while also commenting out the index index.php line.

4got to update, The fix I found was to set ```sh try_files {path} {path}.php ``` to ```sh try_files {path} {path}.php index.php ``` while also commenting out the `index index.php` line.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lolcat/4get#32
No description provided.