Apache2 Configuration Confusion

So, on many other Linux distros you enter following


#
# apcupsd configuration file for Apache Web server
#

# files are off the documentroot of Web server
Alias /apcupsd /var/www/apcupsd
<Directory /var/www/apcupsd>
    AddHandler cgi-script cgi pl
    Options ExecCGI
</Directory>

#
# Allow only local access at default
# Change the ".example.com" to match your domain or modify
# access rights to your needs to enable remote access also.
#
<Directory "/var/www/apcupsd">
    DirectoryIndex upsstats.cgi
    AllowOverride None
    Options ExecCGI Indexes
    Require all denied
</Directory>

into httpd.conf. But in OpenSUSE has different configuration. Now I am confused if I have my own configuration like this should it be in vhosts.d or conf.d directory? Reason for confusion is APCUPSD’s Apache2 configuration files are in conf.d and in documentation it says these entries should be in vhosts.d?

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.apache2.html#sec.apache2.configuration.manually.vhost

By the way tried puttion data.conf (custom directory access) to conf.d and vhosts.d and it works both ways, but my question is which one is more appropriate to use in this case?

I assume it depends if you have vhosts or not. Of course when you have only one “host”, you can handle it as a vhost. I never did.

But this might be a too simplistic approach of mine.

@hcvv
I do appreciate your answer but I would like to know exact reasoning behind this or in other words what are vhosts.d and conf.d for? I do like OpenSUSE and have been using it for 10ish years, but there are things that are not well documented and are confusing people, and me as well and this is one of those weird occasions. I do also understand that they did this for ease of maintenance, but please help me understand what is for what.

I do not see this page mentioning APCUPSD at all so I do not understand how you came to this conclusion.

I know that a friend replaced /var/www/html by a symlink of the same name to /srv/www/htdocs, to be able to reuse the configs he had on another distro. He needed some modules to load with apache but that was about it IIRC.

I would first find out where apcupsd lives ( not in /var/www/apacups I think ). If you use vhosts and need it for one of them, then put it in a vhost’s .conf, if it’s for the default server, I’d put it in it’s own apcupsd.conf in conf.d . Both ways the setttings will be read by apache. But, this depends on your setup.

Ok, I think I might confuse you as well. In documentation it says for conf.d “Configuration files added by other modules”, and for virt.d it says “Your virtual host configuration should be located here”. So where do files created by user with <Directory></Directory> directives go? In other words were should I put my data.conf? Into virt.d or conf.d or somewhere else? Apcupsd is added by installing apcupsd-cli and int is in conf.d because it is a module, php7.conf is also there because it is installed by apache2_mod-php7 or something similar. I hope I have cleared confusion my question is where do I put data.conf?

Use YaST http server module, create a vhost using ( amongst other things ) the data from your conf file. AFAIK they should land in vhosts.d
Now, if you would want this to be part of the defaults, then create a conf file in conf.d

OK, last attempt, since it doesn’t seem clear.
Let’s suppose you have a webserver with 10 vhosts. If you want the module to work for all of them, create a conf file in conf.d ( what’s in there is for the apache server, so for all vhosts ). If only one of them needs the module, put it in the conf in vhosts.d

Thank you this works and this is great explanation!!!