In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to configure the Apache server to prohibit all illegal domain names from accessing your server". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Before http2.4.1:
The first one denies access directly.
Open the httpd.conf file and append the following configuration to the end of the file.
# directly reject all illegal domain names ServerName * ServerAlias * Order Allow,Deny Deny from all ErrorLog "/ alidata/log/httpd/error.log" CustomLog "/ alidata/log/httpd/info.log" common# allowed DocumentRoot / alidata/www ServerName www. Your domain name ServerAlias www. Your domain name Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all RewriteEngine On RewriteRule ^ (. *)-htm- (. *) $.php? RewriteRule ^ (. *) / simple/ ([a-z0-9\ _] +\ .html) $/ simple/index.php? ErrorLog "/ alidata/log/httpd/error.log" CustomLog "/ alidata/log/httpd/info.log" common
Restart the apache service: service httpd restart
The second type jumps to a specified directory or file
Open the httpd.conf file and append the following configuration to the end of the file.
# all illegal domain names jump to the specified directory or file # specified directory or file DocumentRoot "/ yun/www" ServerName * ServerAlias * # allowed domain name DocumentRoot / alidata/www/fdt ServerName www.fdt-art.com ServerAlias www.fdt-art.com Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all RewriteEngine On RewriteRule ^ (. *)-htm- (. *) $.php? RewriteRule ^ (. *) / simple/ ([a-z0-9\ _] +\ .html) $/ simple/index.php? # error log ErrorLog "/ alidata/log/httpd/error.log" CustomLog "/ alidata/log/httpd/info.log" common
Restart the apache service: service httpd restart
2. After http2.4.1:
Http2.4.1 no longer needs NameVirtualHost and does not support ServerName *.
Use ServerName * to report Invalid ServerName "*" use ServerAlias to set multiple server names.
The first one: direct refusal
Open httpd.conf and add the following code to the end of the file:
# prohibit all illegal domain name ServerName server ip ServerAlias * Order Allow,Deny Deny from all # allowed access to the domain name DocumentRoot / alidata/www ServerName www. Your domain name ServerAlias www. Your domain name Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all RewriteEngine On RewriteRule ^ (. *)-htm- (. *) $.php? RewriteRule ^ (. *) / simple/ ([a-z0-9\ _] +\ .html) $/ simple/index.php? # error log location ErrorLog "/ alidata/log/httpd/error.log" CustomLog "/ alidata/log/httpd/info.log" common
Restart the apache service: service httpd restart
Second: jump to a specified directory or file
Open httpd.conf and add the following code to the end of the file:
# prohibit all illegal domain names DocumentRoot "/ alidata/www" ServerName server ip ServerAlias * Order Allow,Deny Allow from all # allowed access to the domain name DocumentRoot / alidata/www/fdt ServerName www.fdt-art.com ServerAlias www.fdt-art.com Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all RewriteEngine On RewriteRule ^ (. *)-htm- (. *) $.php? RewriteRule ^ (. *) / simple/ ([a-z0-9\ _] +\ .html) $/ simple/index.php? # error log location ErrorLog "/ alidata/log/httpd/error.log" CustomLog "/ alidata/log/httpd/info.log" common
Restart the apache service: service httpd restart
This is the end of the content of "how to configure the Apache server to prohibit all illegal domain names from accessing your own server". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.