Centos7.6 Apache virtual machine prohibit access to IP, allows access to multiple multi-domain virtual directory settings

Store configuration files path /etc/httpd/conf.d
custom-named configuration file format ensures * .conf suffix
Note: These are two configuration files, but also two ways.

# A WEB directory
# prohibit access to the IP address of the form
<VirtualHost 192.168 . 8.129 > ServerName 192.168 . 8.129 <the Location /> the Order the Allow, Deny Deny from All </ the Location> </ VirtualHost>
# allow access by a domain name, specify the path < VirtualHost 192.168 . 8.129 > the DocumentRoot /var/www/html/nav.jackcui.com/ ServerName nav.jackcui.com </ VirtualHost>
# Multiple virtual directories
# prohibit access to the IP address of the form
<VirtualHost 192.168 . 8.129 > ServerName 192.168 . 8.129 <the Location /> the Order the Allow, Deny Deny from All </ the Location> </ VirtualHost> # allow access by a domain name, more virtual path specified
<VirtualHost 192.168 . 8.129 > the Alias / Lam / usr / Share / LDAP-account- Manager the Alias / phpldapadmin / usr / Share / phpldapadmin / the htdocs the Alias / ldapadmin / usr / Share / phpldapadmin / the htdocs the Alias / pwd / var / the WWW / HTML
<Directory /usr/share/ldap-account-manager> Options +FollowSymLinks AllowOverride All Require all granted DirectoryIndex index.html </Directory>

<Directory /var/lib/ldap-account-manager/tmp> Options -Indexes </Directory>
<Directory /var/lib/ldap-account-manager/tmp/internal> Options -Indexes Require all denied </Directory>
<Directory /var/lib/ldap-account-manager/sess> Options -Indexes Require all denied </Directory>
<Directory /var/lib/ldap-account-manager/config> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/lib> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/help> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/locale> Options -Indexes Require all denied </Directory> <Directory /usr/share/phpldapadmin/htdocs> <IfModule mod_authz_core.c> # Apache 2.4 Require all granted </IfModule>
#
<IfModule !mod_authz_core.c> # Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> </Directory>
ServerName ldap.jackcui.com
</VirtualHost>

 

Guess you like

Origin www.cnblogs.com/jackcui/p/11489100.html