Unable to Access Caddy Website by IP Alone

1. Caddy version (caddy version):

2.4.6

2. How I run Caddy:

Via Systemctl

a. System environment:

VPS running…
Debian 11.3
PHP 7.4.29

b. Command:

Typically Caddy reload

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:

SouthAfricaSOS.org, www.SouthAfricaSOS.org {
	root * /var/www/SouthAfricaSOS.org
	php_fastcgi unix//run/php/php7.4-fpm.sock
	# php_fastcgi localhost:9000
	file_server # enable serving of static files
	encode gzip

	@disallowed {
		path /xmlrpc.php
		path *.sql
		path /wp-content/uploads/*.php
	}

	rewrite @disallowed '/index.php'
}

FullThrottlePanteras.com, www.FullThrottlePanteras.com {
	root * /var/www/FullThrottlePanteras.com
	php_fastcgi unix//run/php/php7.4-fpm.sock
	# php_fastcgi localhost:9000
	file_server
	encode gzip

	@disallowed {
		path /xmlrpc.php
		path *.sql
		path /wp-content/uploads/*.php
	}

	rewrite @disallowed '/index.php'
}

RiversideFolksongSociety.org, www.RiversideFolksongSociety.org {
	root * /var/www/RiversideFolksongSociety.org
	php_fastcgi unix//run/php/php7.4-fpm.sock
	# php_fastcgi localhost:90009
	file_server
	encode gzip

	@disallowed {
		path /xmlrpc.php
		path *.sql
		path /wp-content/uploads/*.php
	}

	rewrite @disallowed '/index.php'
}

# Primacy.is, www.Primacy.is {
50.21.189.86:80 {
	root * /var/www/Primacy.is
	php_fastcgi unix//run/php/php7.4-fpm.sock
	# php_fastcgi localhost:90009
	file_server
	encode gzip

	#	@disallowed {
	#		path /xmlrpc.php
	#		path *.sql
	#		path /wp-content/uploads/*.php
	#	}

	#	rewrite @disallowed '/index.php'
}

3. The problem I’m having:

I have a validated/formatted Caddyfile above that serves the first three websites perfectly.

caddy validate yields…

‘’’
root@localhost:/etc/caddy# caddy validate
2022/05/01 03:27:22.787 INFO using adjacent Caddyfile
2022/05/01 03:27:22.790 INFO http server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {“server_name”: “srv0”, “https_port”: 443}
2022/05/01 03:27:22.790 INFO http enabling automatic HTTP->HTTPS redirects {“server_name”: “srv0”}
2022/05/01 03:27:22.790 WARN http server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {“server_name”: “srv1”, “http_port”: 80}
2022/05/01 03:27:22.790 INFO tls.cache.maintenance started background certificate maintenance {“cache”: “0xc00019caf0”}
2022/05/01 03:27:22.791 INFO tls.cache.maintenance stopped background certificate maintenance {“cache”: “0xc00019caf0”}
Valid configuration
‘’’

I’m in the process of migrating a fourth Wordpress site to the same VPS BEFORE actually pointing the fourth site’s domain to the new VPS. Hence, the final domain is commented out.

A pre-migration step I need to complete first is to install a pristine version of wordpress under /var/www/Primacy.is

I wish to access the new vps site VIA http, port 80 to set up the new wordpress instance, database, etc. and then run commands like the following:

50.21.189.86/index.php
50.21.189.86/miscscript.php

For reasons I don’t quite fathom using different browsers, none of the following commands let me access and run my php scripts.

http://50.21.189.86/index.php
50.21.189.86:80/index.php

4. Error messages and/or full log output:

5. What I already tried:

See above

6. Links to relevant resources:

Use backticks for code/logs, it’s the key to the left of your 1 key (on US keyboard layouts, anyway); not single quotes.

Single quotes are not supported in the Caddyfile. Use either double quotes or backticks to wrap tokens. See Caddyfile Concepts — Caddy Documentation

But in your case, you don’t need quotes at all, because the token is just a single string with no spaces etc.

Please be more specific. What behaviour are you seeing, exactly? What’s in your logs?

What I’d suggest as the easiest thing for now is to configure a subdomain in your DNS like staging.primacy.is for now, and serve the site with that until you’re ready to switch it over. That way, you’re not connecting over HTTP, and you don’t need to change your main domain’s DNS until you’re ready.