linux系统中部署apache服务(为个人网站设置密码)

实验环境接“ linux系统中部署apache服务(个人用户主页功能)”。

1、在PC1服务器端为用户usertest1创建密码库

[root@PC1 ~]# htpasswd -c /etc/httpd/passwd usertest1  ## 这个usertest1不必是系统已经存在的账户,只是用于登录用
New password: 
Re-type new password: 
Adding password for user usertest1

 

2、在PC1主机中修改个人用户主页功能的配置文件

复制代码
 …………
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客户端测试配置效果

 

 

 

 

 

 

 

 

注:这个账户就是普通的账户,不必是系统已经存在的账户

以上实验实现了对个人主页功能登录账号和密码的设置。

 

posted @   小鲨鱼2018  阅读(550)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示