Goal: Configure a VPS for my own wordpress hosting.
1. Caddy version (caddy version
):
v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=
2. How I run Caddy:
configured systemd service
a. System environment:
openSUSE Leap 15.2 server with systemd.
The system has also php7, php-fpm, mariadb, wordpress installed, configured and running. Side note: I’m an intermediate linux user but a complete newbie on web server knowledge, so I read many online instructions to configure these services. All of their status show that they are actively running.
b. Command:
/usr/bin/caddy
c. Service/unit/compose file:
systemd service file:
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
mydomain.com:443 {
root * /srv/www/wordpress
php_fastcgi unix:/var/run/php-fpm.sock
file_server
log {
output file /var/log/caddy/wordp.log
}
}
3. The problem I’m having:
I’m setting the VPS as my wordpress blog page.
wordpress was installed via opensuse’s webserver repo, to the directory /srv/www/wordpress. I edited /etc/wordpress/wp-config.php to use the mariadb database I created.
For php, I edited /etc/php7/fpm/php-fpm.d/www.conf to listen to 127.0.0.1:9000 and the user:owner to caddy:caddy.
Results: When I visit my domain name in my browser, it shows an “HTTP ERROR 500” page.
4. Error messages and/or full log output:
I do not know how to format these logs from the linux command “tail …/caddylog”
m{"level":"error","ts":1598060787.0747938,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/wp","proto":"HTTP/2.0","remote_addr":"ip:60208","host":"mydomainname","headers":{"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Dest":["document"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Accept-Encoding":["gzip, deflate, br"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:18:46:27 -0700] \"GET /wp HTTP/2.0\" 404 0","duration":0.000490151,"size":0,"status":404,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598061421.46783,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/test.php","proto":"HTTP/2.0","remote_addr":"ip:33262","host":"mydomainname","headers":{"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-User":["?1"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:18:57:01 -0700] \"GET /test.php HTTP/2.0\" 404 0","duration":0.000822196,"size":0,"status":404,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598061700.8770173,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/test.php","proto":"HTTP/2.0","remote_addr":"ip:33692","host":"mydomainname","headers":{"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Dest":["document"],"Cache-Control":["max-age=0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:01:40 -0700] \"GET /test.php HTTP/2.0\" 500 0","duration":0.001535405,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598061708.2198591,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/WP","proto":"HTTP/2.0","remote_addr":"ip:33692","host":"mydomainname","headers":{"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:01:48 -0700] \"GET /WP HTTP/2.0\" 500 0","duration":0.000196033,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598061713.7752202,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"ip:33692","host":"mydomainname","headers":{"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-User":["?1"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:01:53 -0700] \"GET / HTTP/2.0\" 500 0","duration":0.000202024,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598061717.398518,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"ip:33692","host":"mydomainname","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"],"Cache-Control":["max-age=0"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"]},"tls":{"resumed":false,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:01:57 -0700] \"GET / HTTP/2.0\" 500 0","duration":0.000173086,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598063455.0765843,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"ip:35180","host":"mydomainname","headers":{"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Mode":["navigate"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"],"Cache-Control":["max-age=0"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:30:55 -0700] \"GET / HTTP/2.0\" 500 0","duration":0.000810769,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598063575.5125587,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"ip:35180","host":"mydomainname","headers":{"Cache-Control":["max-age=0"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:32:55 -0700] \"GET / HTTP/2.0\" 500 0","duration":0.001554816,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598063580.427445,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/wp","proto":"HTTP/2.0","remote_addr":"ip:35180","host":"mydomainname","headers":{"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"],"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Mode":["navigate"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:19:33:00 -0700] \"GET /wp HTTP/2.0\" 500 0","duration":0.000255983,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
{"level":"error","ts":1598066303.4663463,"logger":"http.log.access.log0","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/2.0","remote_addr":"ip:37342","host":"mydomainname","headers":{"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"],"Sec-Fetch-Site":["none"],"Accept-Language":["en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,fr;q=0.6"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip, deflate, br"]},"tls":{"resumed":true,"version":772,"ciphersuite":4865,"proto":"h2","proto_mutual":true,"server_name":"mydomainname"}},"common_log":"ip - - [21/Aug/2020:20:18:23 -0700] \"GET / HTTP/2.0\" 500 0","duration":0.000552886,"size":0,"status":500,"resp_headers":{"Server":["Caddy"]}}
5. What I already tried:
Changed many times how the caddyfile looks.There was a time when I visited the domain name, it started to download a file “setup-config.php”, in which the content started with:
* Retrieves and creates the wp-config.php file.
*
* The permissions for the base directory must allow for writing files in order
* for the wp-config.php to be created using this page.
*
* @package WordPress
* @subpackage Administration
*/
/**
* We are installing.
*/
....
But now it’s just “HTTP ERROR 500”
6. Links to relevant resources:
Read too many instructions to list here.