1. sudo apt-get install apache2
有询问Yes的地方Yes就行。
无法安装apache2
执行 sudo apt-get update
2.等待安装完成,进入配置文件目录, cd /etc/apache2/
3. 将配置文件备份, sudo cp apache2.conf apache2.conf.bak 这是个人习惯。
4.配置文件中主要有这几项修改:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory> #这个表示禁用根目录 Directory 后接路径。中间的是权限表示。
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory> #这是http默认的目录一般修改这一部分就好了。我把默认路径改成 <Directory /srv/https/>
<Directory /var/www/cgi-bin/>