安装软件
# yum install httpd httpd-devel
启动
# /etc/init.d/httpd start
在浏览器中输入
http://localhost,即可访问
--------------------------------------------------------------------
配置文件
/etc/httpd/conf/httpd.conf
配置文件参数说明:
DocumentRoot "/var/www/html" 发布网站目录,即是http://localhost地址访问的目录
---------------------------------------------------------------------
创建个人发布目录
注意:关闭防火墙和selinux
# service iptables stop
# setenforce 0
添加用户:
#useradd lihui
创建发布目录:
mkdir /home/lihui/public_html
赋给访问权限
chmod -R +x /home/lihui
在配置文件中,修改
<IfModule mod_userdir.c> #默认发布目录名
UserDir public_html
</IfModule>
Alias /lihui "/home/lihui/public_html/" #个人目录的别名
<Directory "/home/lihui/public_html/"> #个人目录配置
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
浏览器输入
----------------------------------------------------------------
创建访问限制
家目录下添加用户密码 用户与系统用户无关
New password:
Re-type new password:
Adding password for user tom
#vim .htaccess,加入
authname "welcome to my homepage"
authtype basic
authuserfile "/home/lihui/public_html/.htpasswd"
require valid-user
service httpd restart
http://localhost/lihui,就需要输入刚刚的密码了