# This configuration file enables the default "Welcome" # page if there is no default index page present for # the root URL. To disable the Welcome page, comment # out all the lines below. # # #把红色内容进行注释 # Options -Indexes # ErrorDocument 403 /error/noindex.html # 重启: [root@http ~]# service httpd restart
创建首页文件 [root@http ~]# echo "welcome to this country" > /var/www/html/index.html注:selinux 关闭 getenforce查看
Options Indexes FollowSymLinks AllowOverride None Order deny,allow Allow from all authtype basic #基本认证 authname "MySQL admin software" 可以随意命名 authuserfile /etc/httpd/conf/passwd.secret #密文配置文件路径 require valid-user #有效用户 #require user tom #拒绝访问的用户 #require user tom bob #拒绝访问的多个用户
重启apache 访问http://192.168.2.101/http验证
生成认证账号和密码 [root@http html]# htpasswd -cm /etc/httpd/conf/passwd.secret hk New password: Re-type new password: Adding password for user hk 再次验证:
方法二: [root@http html]# vim /etc/httpd/conf/httpd.conf
Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all AllowOverride AuthConfig
# AllowOverride AuthConfig一行表示允许对/usr/local/http/目录下的文件进行用户认证。 [root@http html]# vim /usr/local/phpmyadmin/.htaccess authtype basic authname "haa" authuserfile /etc/httpd/conf/passwd.secret #require user tom require valid-user
配置Apache虚拟主机,实现在一台服务器上运行多个网站 :http://blog.51cto.com/13719714/2109040
相关Mysql-proxy实现读写分离参考链接:http://blog.51cto.com/13719714/2107691
使用LAMP环境搭建wordpress论坛参考链接:http://blog.51cto.com/13719714/2108415
源码编译LNMP请参考链接:http://blog.51cto.com/13719714/2110940