How to Add Custom Conf File

#1
Hi everyone,
I want to ask about something I do in Apache but don't know how to do for OLS. To be effective on all websites, I create a custom.conf file in the "/etc/apache2/conf.d/" directory and create IP addresses or similar rules that I want to block. The rule I wrote this way works on all websites. How can I do this for OLS? In which directory should I create a file to add my own rules?
OS: AlmaLinux 8.9
OLS -v: Latest
 

Cold-Egg

Administrator
#2
There's an Access Control feature under virtual host level, you can add the IP from there.

If you want the config, here's an example,
Code:
accessControl  {
  deny                    1.2.3.4
}
 
#3
There's an Access Control feature under virtual host level, you can add the IP from there.

If you want the config, here's an example,
Code:
accessControl  {
  deny                    1.2.3.4
}
This way it will only be valid for one vhost, right? How can I add it to existing websites and future ones?
 

Cold-Egg

Administrator
#4
Create an access control config file, and include it in any virtual host you want. Or set it on the server level, web admin > Security > Access Control, this will apply to all the websites.
 
#5
Create an access control config file, and include it in any virtual host you want. Or set it on the server level, web admin > Security > Access Control, this will apply to all the websites.
Actually what I want to do is not limited to allowing or disallowing an IP address. I want any rule I create, like I did in Apache, to apply to all websites at the server level.
 
Last edited:
#7
Could you share some example rules?
Yes here;

Code:
<IfModule mod_headers.c>
    SetEnvIf Accept-Language "^gb" allow_country
    SetEnvIf Remote_Addr "^66\.249\." allow_ip
    SetEnvIf User-Agent "AMPHTML_FETCH" allow_user_agent
    SetEnvIf User-Agent "Google" allow_user_agent
    SetEnvIf User-Agent "NOGAY_AMP_DMCA_REQUEST" allow_user_agent
    SetEnvIf User-Agent "NOGAY_SOFTWARE_VERIFICATION" allow_user_agent
    SetEnvIf User-Agent "NOGAY_AMPHTML_FETCH" allow_user_agent

    Order Deny,Allow
    Deny from all

    Allow from env=allow_country
    Allow from env=allow_ip
    Allow from env=allow_user_agent
</IfModule>
 
Top