How can block some URLs after run apache (httpd)

Alles, was den Apache betrifft, kann hier besprochen werden.

How can block some URLs after run apache (httpd)

Postby babak » 31. December 2020 04:56

After run and install Apache we can access three address by default :

https://ip_address/manual/
https://ip_address/mailman/listinfo
https://ip_address/mailman/create

Now I want block above addresses but don't know which config file and where had to modify to block these paths
Would you please hep me about that ?
babak
 
Posts: 3
Joined: 31. December 2020 04:53
XAMPP version: 5
Operating System: Redhat

Re: How can block some URLs after run apache (httpd)

Postby Altrea » 31. December 2020 09:14

Block from what? All requests?
You could write a deny for each of this folders in your httpd.conf like so:

Code: Select all
<Directory /opt/lampp/htdocs/manual>
    Require all denied
</Directory>
<Directory /opt/lampp/htdocs/mailman/listinfo>
    Require all denied
</Directory>
<Directory /opt/lampp/htdocs/mailman/create>
    Require all denied
</Directory>
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: How can block some URLs after run apache (httpd)

Postby Nobbie » 31. December 2020 11:58

You also could create VirtualHosts and create one with IP Address as ServerName and finally add the Require all denied into that VirtualHost, what denies each access to that IP in the URL.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: How can block some URLs after run apache (httpd)

Postby babak » 02. January 2021 07:05

Altrea wrote:Block from what? All requests?
You could write a deny for each of this folders in your httpd.conf like so:

Code: Select all
<Directory /opt/lampp/htdocs/manual>
    Require all denied
</Directory>
<Directory /opt/lampp/htdocs/mailman/listinfo>
    Require all denied
</Directory>
<Directory /opt/lampp/htdocs/mailman/create>
    Require all denied
</Directory>


Thanks. Unfortunately I don't have these config in my httpd.conf file but there are 2 files mailman.conf and manual.conf on this path : /etc/httpd/conf.d/

and I changed both of them such as this but after restart httpd all urls still open :

mailman.conf

Code: Select all
#httpd configuration settings for use with mailman.
#

ScriptAlias /mailman/ /usr/lib/mailman/cgi-bin/
<Directory /usr/lib/mailman/cgi-bin/>
#    AllowOverride None
#    Options ExecCGI
#    Order allow,deny
#    Allow from all
Require all denied
</Directory>


Alias /pipermail/ /var/lib/mailman/archives/public/
<Directory /var/lib/mailman/archives/public>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    AddDefaultCharset Off
</Directory>




manual.conf

Code: Select all
#
# This configuration file allows the manual to be accessed at
# http://localhost/manual/
#
AliasMatch ^/manual(?:/(?:de|en|fr|ja|ko|ru))?(/.*)?$ "/var/www/manual$1"

<Directory "/var/www/manual">
#    Options Indexes
#    AllowOverride None
#    Order allow,deny
#    Allow from all
Require all denied
</Directory>

babak
 
Posts: 3
Joined: 31. December 2020 04:53
XAMPP version: 5
Operating System: Redhat

Re: How can block some URLs after run apache (httpd)

Postby Nobbie » 02. January 2021 13:13

You did not tell us that you did not install Xampp (this is the Xampp Forum, Apache from Xampp) and you did not tell us your Apache release. Seems to be an older one, which does not know "Require", instead uses "Allow From..." and "Deny From...." in your config. See your Apache Documentation about Allow and Deny.

Actually, i will warn you, if you really add Deny from all to that configuration, NONE of mailman URLs will work. Same for manual, none of them will work anyway. I think you added the Alias for a certain reason, that wont work any longer. I dont know what you are doing there, but it looks as if you need mailman and manual for a tool or so.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: How can block some URLs after run apache (httpd)

Postby babak » 03. January 2021 08:56

Nobbie wrote:You did not tell us that you did not install Xampp (this is the Xampp Forum, Apache from Xampp) and you did not tell us your Apache release. Seems to be an older one, which does not know "Require", instead uses "Allow From..." and "Deny From...." in your config. See your Apache Documentation about Allow and Deny.

Actually, i will warn you, if you really add Deny from all to that configuration, NONE of mailman URLs will work. Same for manual, none of them will work anyway. I think you added the Alias for a certain reason, that wont work any longer. I dont know what you are doing there, but it looks as if you need mailman and manual for a tool or so.



So thanks . The problem solved according to 2nd post.
babak
 
Posts: 3
Joined: 31. December 2020 04:53
XAMPP version: 5
Operating System: Redhat


Return to Apache

Who is online

Users browsing this forum: No registered users and 17 guests