Skip to main content

help with directory indexing

Comments

5 comments

  • cPRex Jurassic Moderator
    Hey there! That isn't how the Apache system works, but we may be able to come up with an alternative. If you wanted to host some content on the server's hostname, which isn't recommended, that would end up in /var/www/html. Can you try placing your files there instead to see if that behaves how you're expecting? If I was going to do this, I'd create docs.hostdomain.com as a subdomain with its own cPanel account, so you can still use the same domain as the hostname without using the actual hostname itself.
    0
  • ca2236
    I could try to create a subdomain with that, I was trying to keep it consistent with non cpanel servers. But I know cpanel is a different beast sometimes. in non cpanel servers, although, they probably have a vhosts entry for that direct past, so I think I will try the both methods for curiosity, but leaning towards the subdomain idea. Thanks! I will let you know what way works.
    0
  • ca2236
    ok, I tried /var/www/html and it works like I want, now to lock it down. so that outside can't access it. If we block access to it with allow directives, are there still security concerns? I was just seeing two other locations for servername.domain.tld/docs in /var/www/ and /www/sites I wasn't for sure, thanks for your help
    0
  • cPRex Jurassic Moderator
    Sure, you can place a .htaccess file in there like any other web directory, and it will work how you expect. There isn't a security issue with this, we just don't recommend it to avoid confusion down the road as this doesn't get handled under a typical user structure like other web-facing content on a cPanel machine. Just ensure you don't remove the .well-known directory or else the hostname AutoSSL will not be able to renew properly.
    0
  • ca2236
    I used a location directive under include editor pre-main in apache config and seems to be working for security. Thanks for the help
    0

Please sign in to leave a comment.