apache用户认证完成后浏览器总是无法弹出认证框?
[root@localhost ~]# cd /data/www
[root@localhost ~]# mkdir abc
[root@localhost ~]# cd abc
[root@localhost abc]# ls
[root@localhost abc]# cp /etc/passwd ./12.txt
配置用户认证:
[root@localhost ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
<VirtualHost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.aaa.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
< Directory /data/www/abc/>
AllowOverride AuthConfig
AuthName "www123com"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
< /Directory>
< /VirtualHost>
设置用户名和密码:
[root@localhost ~]# htpasswd -c /data/.htpasswd user1
[root@localhost ~]# htpasswd /data/.htpasswd user2
[root@localhost abc]# apachectl -t
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
Syntax OK
[root@localhost abc]# apachectl graceful
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd not running, trying to start
(98)Address already in use: make_sock: unable to listen for connections on address [::]:80
(98)Address already in use: make_sock: unable to listen for connections on address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[root@localhost abc]# /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
httpd (pid 3623) already running
[root@localhost abc]# netstat -lnp |grep httpd
tcp 0 0 :::80 :::* LISTEN 3623/httpd
重新访问 www.test.com/abc/12.txt,结果还是直接显示页面内容,没有弹出用户认证的框?
编辑回复