centos7编译安装apache后添加用户认证和配置虚拟主机
2016-12-06 09:38
731 查看
编译安装apache后的目录文件:/usr/local/apache2
1:用户认证
主配置目录:/usr/local/apache2/conf/
1)建立目录并设置用户认证:Alias /1.php/ “/usr/local/apache2/htdocs/1.php”
<Directory"/usr/local/apache2/htdocs/"> AllowOverride None Options None Order allow,deny Deny from all AuthType Basic AuthName "Please Login:" AuthUserFile /usr/local/apache2/bin/mywebpd #存密码的目录 Require User root tong #用户</Directory>
2:配置虚拟主机/usr/local/apache2/conf/extra/httpd-vhosts.conf配置基于IP的虚拟主机,IP地址相同,但端口号不同的虚拟主机配置,
虚拟主机分别对应的目录为/usr/local/apache/htdocs/web1和/usr/local/apache/htdocs/web2:Listen 80#Listen 8080<VirtualHost 192.168.217.137:80> ServerSignature email DocumentRoot /usr/local/apache/htdocs/web1 DirectoryIndex web1.html
LogLevel warm HostNameLookups off</VirtualHost><VirtualHost 192.168.217.137:8080> ServerSignature email DocumentRoot /usr/local/apache/htdocs/web2 DirectoryIndex web2.html index.htm LogLevel warm HostNameLookups off</VirtualHost>效果图:
1:用户认证
主配置目录:/usr/local/apache2/conf/
1)建立目录并设置用户认证:Alias /1.php/ “/usr/local/apache2/htdocs/1.php”
<Directory"/usr/local/apache2/htdocs/"> AllowOverride None Options None Order allow,deny Deny from all AuthType Basic AuthName "Please Login:" AuthUserFile /usr/local/apache2/bin/mywebpd #存密码的目录 Require User root tong #用户</Directory>
2:配置虚拟主机/usr/local/apache2/conf/extra/httpd-vhosts.conf配置基于IP的虚拟主机,IP地址相同,但端口号不同的虚拟主机配置,
虚拟主机分别对应的目录为/usr/local/apache/htdocs/web1和/usr/local/apache/htdocs/web2:Listen 80#Listen 8080<VirtualHost 192.168.217.137:80> ServerSignature email DocumentRoot /usr/local/apache/htdocs/web1 DirectoryIndex web1.html
LogLevel warm HostNameLookups off</VirtualHost><VirtualHost 192.168.217.137:8080> ServerSignature email DocumentRoot /usr/local/apache/htdocs/web2 DirectoryIndex web2.html index.htm LogLevel warm HostNameLookups off</VirtualHost>效果图:
相关文章推荐
- linux的Nginx安装、默认虚拟主机、用户认证、域名重定向配置介绍
- nginx介绍,nginx安装,配置nginx默认虚拟主机,nginx用户认证,域名重定向
- Nginx安装与配置:默认虚拟主机、用户认证和域名重定向
- LAMP架构(nginx安装,默认虚拟主机,用户认证,域名重定向,nginx配置文件详解)
- LNMP架构 (2)之 Nginx安装、默认虚拟主机、用户认证、域名重定向、配置文件详解
- apache设置用户认证及配置各种虚拟主机
- 在RHEL5下构建LAMP网站服务平台之编译安装Apache与配置基于域名的虚拟Web主机
- Apache2.2.17源码编译安装以及配置虚拟主机
- 在Red Hat Linux5下构建LAMP网站服务平台之编译安装Apache与配置基于域名的虚拟Web主机
- 安装nginx、nginx配置虚拟主机、用户认证、域名重定向
- apache虚拟主机基础配置(用户认证,域名跳转)
- CentOS7 初次安装记录(五)配置 apache 虚拟主机
- 从源代码编译安装Apache-httpd-2.4.23及虚拟主机和反向代理的配置
- 源码编译安装LNMP环境及配置基于域名访问的多虚拟主机
- ubuntu下apt-get安装apache的虚拟主机的配置
- Windows环境下Apache的安装与虚拟主机, 虚拟目录的配置
- apache工作机制,压缩,虚拟主机,用户认证
- centos6.5下vsftpd服务的安装及配置并通过pam认证实现虚拟用户文件共享
- httpd-2.4.9编译安装与配置(CGI、虚拟主机、https、deflate压缩)
- nginx的高级配置(1)——为某个虚拟主机添加用户验证