要求:
安装apache服务;
域名:www.sdskills.com
使用apache服务;
网页文件放在/data/share/htdocs/skills;
服务以用户webuser运行;
首页内容为“This is the front page of sdskills’s website.”;
/htdocs/skills/staff.html内容为“Staff Information”;
该页面需要员工的账号认证才能访问;
员工账号存储在ldap中,账号为zsuser、lsus
步骤:
安装apache2
apt-get install apache2 -y
更改apache2根目录
/usr/bin/vim.tiny /etc/apache2/sites-enabled/000-default.conf
/usr/bin/vim.tiny /etc/apache2/apache2.conf
创建网站根目录
mkdir /data/share/htdocs/skills -p
创建网站首页
cd /data/share/htdocs/skills/
touch index.html
echo "This is the front page of sdskills's website." > index.html
创建用户
/usr/sbin/useradd -G www-data webuser
更改配置
/usr/bin/vim.tiny /etc/apache2/apache2.conf
重启服务
测试
systemctl restart apache2
top
添加配置
/usr/bin/vim.tiny /etc/apache2/apache2.conf
<Directory /data/share/htdocs/skills/staff.html>
AuthType Basic
AuthName "password"
AuthUserFile /etc/apache2/1dap
require user zsuser
</Directory>
创建认证网页
touch staff.html
echo "Staff Information" > staff.html
创建密码文件
htpasswd -c /etc/apache2/1dap zsuser
重启服务
测试