How to make Error Logs actually informative?

1. Caddy version (caddy version):

v2.2.1 h1:Q62GWHMtztnvyRU+KPOpw6fNfeCD3SkwH7SfT1Tgt2c=

a. System environment:

Docker, PHP FPM on docker HOST

d. My complete Caddyfile or JSON config:

The complete caddyfile for this setup

#so i dont have this doubled on two different domains)
(486netPHP) {
	templates
	php_fastcgi unix//run/php-fpm/php-fpm.sock
	file_server {
		index  index.php
	}
	# Need this rewrite otherwise it only shows the RAW php file and not rendered 
	rewrite / /index.php
}
http://192.168.0.101 {
	root * /home/486net/edit
	import 486netPHP
	log {
		output file /home/486net/log/edit.486net.log
		format json
		# Documentation for this really doesnt show anything on how to use the `level` log directive.
		level ERROR
	}
}

3. The problem I’m having:

When trying to access https://www.atheos.io/ PHP, it gives error 500. However when i visit a normal php page, like so

<html>
	<head>
		<link rel="icon" href="favicon.ico" type="image/x-icon">
		<meta charset = "UTF-8"></meta>
		<title>
			486Net Site List
		</title>
		<meta charset = "UTF-8">
		<meta name="viewport" content="width=device-width">
		<?php
			$dirs = array_filter(glob('*'), 'is_dir');
			$arraylength = sizeof($dirs) - 2
		?>
	</head>
	<body>
			<center>
				<font size = +3>
					Welcome to <b><i>486Net</i></b>
				</font>
			</center>
		<hr>
			<center>
				[ <?php echo $arraylength," TOTAL SITES" ?> ]
			</center>
		<hr>
		<table border = 1 width = 100%>
			<?php
				foreach ($dirs as $folder){
					if ($folder == "assets" ) {
					} elseif ($folder == "FolderTest") {
					} else {
						if (file_exists($folder . "/info.json")) {
							$jsonFile = file_get_contents($folder . "/info.json");
							$info = json_decode($jsonFile, true);
							echo '<tr><td><a href = "/', $folder, '/', $info[index], '">', $info[name], ': ', $info[desc], '</a></td></tr>';
						} else {
							echo '<tr><td><a href = "/', $folder, '/">', $folder, '</a></td></tr>';
						}
					}
				}
				?>
			</table>
	</body>
</html>

It works .just FINE

4. Error messages and/or full log output:

{
  "level": "error",
  "ts": 1604949443.423527,
  "logger": "http.log.access.log0",
  "msg": "handled request",
  "request": {
    "remote_addr": "192.168.0.109:12517",
    "proto": "HTTP/1.1",
    "method": "GET",
    "host": "192.168.0.101",
    "uri": "/",
    "headers": {
      "Accept-Encoding": [
        "gzip, deflate"
      ],
      "Accept-Language": [
        "en-US,en;q=0.9"
      ],
      "Connection": [
        "keep-alive"
      ],
      "Cache-Control": [
        "max-age=0"
      ],
      "Upgrade-Insecure-Requests": [
        "1"
      ],
      "User-Agent": [
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
      ],
      "Accept": [
        "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
      ]
    }
  },
  "common_log": "192.168.0.109 - - [09/Nov/2020:19:17:23 +0000] \"GET / HTTP/1.1\" 500 0",
  "duration": 0.009260238,
  "size": 0,
  "status": 500,
  "resp_headers": {
    "X-Powered-By": [
      "PHP/7.4.12"
    ],
    "Strict-Transport-Security": [
      "max-age=31536000; includeSubDomains; preload"
    ],
    "Access-Control-Allow-Origin": [
      "*"
    ],
    "Referrer-Policy": [
      "no-referrer"
    ],
    "Content-Type": [
      "text/html; charset=UTF-8"
    ],
    "Content-Length": [
      "0"
    ],
    "Server": [
      "Caddy"
    ],
    "Status": [
      "500 Internal Server Error"
    ],
    "X-Frame-Options": [
      "SAMEORIGIN"
    ],
    "Feature-Policy": [
      "sync-xhr 'self'"
    ],
    "X-Xss-Protection": [
      "1; mode=block"
    ],
    "X-Content-Type-Options": [
      "nosniff"
    ]
  }
}

5. What I already tried:

I have no clue what to try, never had this issue with caddyV1 before,

I have contacted Atheos via their github, and they basically were scratching their heads confused

6. Links to relevant resources:

https://github.com/Atheos/Atheos/issues/144

500 is an internal server error, so something is probably wrong with your backend. That’s all Caddy knows. Check your PHP logs.

PHP didnt log jack all, and fixed it. it was a file perm issue for SOME reason. had to set the entire folder to 757

Ok, but maybe it should be 755 at most; you don’t want to give any process exec privileges where possible.

This topic was automatically closed after 30 days. New replies are no longer allowed.