实验环境 阿里云 ubuntu16.04 apache2

自己瞎吉儿搞得理解不一定到位,步骤可能略有不同,就酱懒得改了。

安装

sudo apt-get install apache2
访问ip检查安装是否成功
apache ubuntu16.04 下部分功能配置


虚拟目录

先在/var/www 下建立新目录,并在其中新建index.html,随便加点内容便于区分,进行下面实验
apache ubuntu16.04 下部分功能配置
apache ubuntu16.04 下部分功能配置
apache ubuntu16.04 下部分功能配置
配置主配置文件
/etc/apache2/sites-available/000-default.conf,加入如下两行后重启服务service apache2 restart
Alias /虚拟目录 /物理路径
apache ubuntu16.04 下部分功能配置
apache ubuntu16.04 下部分功能配置


虚拟主机配置

基于ip地址、域名无法验证没有实现。下为基于端口。

/etc/apache2/sites-available/000-default.conf 加入如下配置
apache ubuntu16.04 下部分功能配置
监听转发81端口,还需要在阿里云打开端口访问权限,重启service apache2 restart
apache ubuntu16.04 下部分功能配置


基于主机授权

先确认本机ip。
/etc/apache2/sites-available/000-default.conf 加入如下配置
apache ubuntu16.04 下部分功能配置
重启service apache2 restart
正常访问
apache ubuntu16.04 下部分功能配置
限制访问
apache ubuntu16.04 下部分功能配置


基于用户认证

/etc/apache2/sites-available/000-default.conf 加入如下配置
apache ubuntu16.04 下部分功能配置
htpasswd -c /etc/apache2/sites-available/myconf wzy 分别是刚刚的目标路径 与 用户名
apache ubuntu16.04 下部分功能配置
重启service apache2 restart

访问目标网址
apache ubuntu16.04 下部分功能配置


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2021-06-26
  • 2021-08-31
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2021-11-15
  • 2021-08-12
  • 2021-09-19
相关资源
相似解决方案