Operating System & Version
CentOS 7.9.2009
cPanel & WHM Version
100.0.9

Yogi Coder

Member
Apr 8, 2018
7
0
1
India
cPanel Access Level
Root Administrator
I have been trying to use apache 2.4 directives for restricting access to my site to a particular IP with no luck so far.

I am using following syntax in the pre_vhost_global file -

<Directory /home/user/directory/subfolder>
AllowOverride None
Require all denied
Require ip x.x.x.x
</Directory>

But it is not restricting access to anyone. Am I doing something wrong here? Please help.
 

quietFinn

Well-Known Member
Feb 4, 2006
1,659
335
438
Finland
cPanel Access Level
Root Administrator
I put this in Pre VirtualHost Include, All versions:
Code:
<Directory "/home/user/public_html">

    Options Indexes FollowSymLinks

    AllowOverride None

    Require all denied

    Require ip x.x.x.x

</Directory>
and it seems to work as expected.
 

Yogi Coder

Member
Apr 8, 2018
7
0
1
India
cPanel Access Level
Root Administrator
Thank you for your quick response. Unfortunately that did not work either.
I used to use the old syntax earlier
deny from all

But recently after the updates it stopped working. Looks like this issue is specific to my server and I may need to open ticket.