hostname points to wrong folder

Pieter

Verified User
Joined
Mar 27, 2016
Messages
24
I'm using my hostname (e.g. host.server.com) as a webhook destination for CSP reports.

Just noticed my hostname points to the following folder:
/home/admin/domains/sharedip/ (here PHP files are printed displayed in plain text)

Previously my hostname pointed to:
/var/www/html/ (with full htaccess and php support).

Note: a few weeks ago I changed the webserver from nginx-apache to apache + did a config rewrite. Not sure if this changed the folder but could be related.

Any tips on how to get my hostname pointing to the default folder again?
 
Hello,

Do you have a single IP or multiples ones? If the second you will need to make sure the hostname resolves to the IP that is marked as "server" on a IP management page in Directadmin. If IPv6 is used, then you might need to make sure, it is linked to the server's IP.
 
Hi,

Thanks for the reply!

The server has 1 IPv4 and 1 IPv6

Under 'IP Management' the IPv4 is listed as server IP and the IPv6 is listed as shared (linked to the IPv4)

All the best,
Pieter
 
The Apache server status page, phpMyAdmin and DirectAdmin can be accessed through the hostname without a problem.
 
Thanks! Just checked, it is listed as

DocumentRoot "/home/admin/domains/sharedip"

Changing it to the value below fixes the issue.
DocumentRoot "/var/www/html"

Any downsides to changing it to a (probably) non default value?
 
No, not as far as i know..

I use a hook for it, create a file in /usr/local/directadmin/scripts/custom/ named ipsconf_write_post.sh with the follow content to automatically get changed when changing ip related stuff.

Code:
#!/bin/sh

sed -i '/\/home\/admin\/domains\/sharedip/c\\tDocumentRoot \/var\/www\/html' /etc/httpd/conf/ips.conf

exit 0;
 
My /etc/httpd/conf/ips.conf has a correct path to DocumentRoot "/var/www/html" on a server with single IPv4 and IPv6. If the file content differs on your end it would mean, that you have wrong settings in "IP Manager" in Directadmin. Probably you marked an IPv4 and/or IPv6 as shared in DirectAdmin.

And instead of using patches, you'd better go to DirectAdmin "IP Manager" and remove "shared" flag from IPs.
 

Attachments

  • 2025-04-23_152741_poralix.png
    2025-04-23_152741_poralix.png
    50 KB · Views: 2
Back
Top