实验环境接“ linux系统中部署apache服务(个人用户主页功能)”。
[root@PC1 ~]# htpasswd -c /etc/httpd/passwd usertest1 ## 这个usertest1不必是系统已经存在的账户,只是用于登录用
New password:
Re-type new password:
Adding password for user usertest1
…………
28 # Control access to UserDir directories. The following is an example
29 # for a site where these directories are restricted to read-only.
30 #
31 <Directory "/home/*/public_html">
32 AllowOverride all
33 authuserfile "/etc/httpd/passwd"
34 authname "My privately website"
35 authtype basic
36 require user usertest1 ## 这个账户不必是已经存在的用户,只是一个登录账号
37 </Directory>
38
3、 在PC1服务器端重启httpd服务
[root@PC1 ~]# systemctl restart httpd
[root@PC1 ~]# systemctl enable httpd
[root@PC1 ~]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
Active: active (running) since Thu 2020-12-17 00:04:07 CST; 19s ago
Main PID: 4861 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─4861 /usr/sbin/httpd -DFOREGROUND
├─4862 /usr/sbin/httpd -DFOREGROUND
├─4863 /usr/sbin/httpd -DFOREGROUND
├─4864 /usr/sbin/httpd -DFOREGROUND
├─4865 /usr/sbin/httpd -DFOREGROUND
└─4866 /usr/sbin/httpd -DFOREGROUND
Dec 17 00:04:07 PC1 systemd[1]: Starting The Apache HTTP Server...
Dec 17 00:04:07 PC1 httpd[4861]: AH00557: httpd: apr_sockaddr_info_get() Failed for PC1
Dec 17 00:04:07 PC1 httpd[4861]: AH00558: httpd: Could not reliably determine the s...age
Dec 17 00:04:07 PC1 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
3、在PC2客户端测试配置效果
注:这个账户就是普通的账户,不必是系统已经存在的账户
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。