LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   Apache2.4 Ip address allow? (https://www.linuxquestions.org/questions/centos-111/apache2-4-ip-address-allow-4175653755/)

drillsar 05-12-2019 01:40 AM

Apache2.4 Ip address allow?
 
I am trying to lock my wp-admin wordpress to just my ip address

I have the following:

I added this in my VirtualHost configuration

<Files "wp-login.php">
Require ip 123.123.123.123
</Files>

It says You don't have permission to access

I can't figure out why..

bathory 05-12-2019 03:00 AM

Quote:

Originally Posted by drillsar (Post 5994227)
I am trying to lock my wp-admin wordpress to just my ip address

I have the following:

I added this in my VirtualHost configuration

<Files "wp-login.php">
Require ip 123.123.123.123
</Files>

It says You don't have permission to access

I can't figure out why..

I guess you've restarted apache after adding the above.
Then make sure the IP you're using to access wp-login.php is the one listed above and you have cleared your browser's cache.

drillsar 05-12-2019 09:46 AM

Yes did all that but still says I don't have permission.

drillsar 05-12-2019 10:45 AM

In the error log it says the following:

client 192.168.1.1 denied by server configuration. This is my router. If I add Reguire IP 192.168.1.1 It works but curious why this and not my public ip?

Is that the right approach and it will deny any other IP that tries to access?

<Files wp-login.php>
Require ip 192.168.1.1 #my public ip don't work
</Files>
<Files admin-ajax.php>
Require all granted
</Files>

bathory 05-12-2019 12:44 PM

Quote:

client 192.168.1.1 denied by server configuration. This is my router. If I add Reguire IP 192.168.1.1 It works but curious why this and not my public ip?

Is that the right approach and it will deny any other IP that tries to access?
It looks like your router is not just forwarding port 80 to your webserver, but it's acting like a reverse proxy to it.
I guess you should look at the router configuration to see why it's behaving like this.

Anyway, allowing access to the wp-login page, just to your IP it's a good security measure.
You can use also other tools, like fail2ban to stop brute force attacks to wp-login

drillsar 05-12-2019 03:52 PM

I have no idea where to look why the router is doing this, is it the /etc/hosts, /etc/resolv.conf or dynamic dns?

bathory 05-13-2019 02:04 AM

Quote:

Originally Posted by drillsar (Post 5994393)
I have no idea where to look why the router is doing this, is it the /etc/hosts, /etc/resolv.conf or dynamic dns?

I don't know.
You should read the router's documentation and perhaps use your favorite search engine to see what you can do.

Regards


All times are GMT -5. The time now is 05:31 AM.