1.在终端输入更新检查命令,sudo apt-get update
- 在更新完成后(如果不想检查更新,也可直接输入此步)输入:sudo apt-get install apache2
3.完成后,在浏览器输入https://localhost 或者127.0.0.1,如果顺利跳出Apache版本网页,即代表安装成功
4.停止服务:sudo /etc/init.d/apache2 stop
5. Apache的默认文档根目录是在Ubuntu上的/var/www目录 ,配置文件是/ etc/apache2/apache2.conf。配置存储在的子目录在/etc/apache2目录。
//开启apache: sudo apachectl start
//重启apache: sudo apachectl restart
//关闭apache: sudo apachectl stop
Mac apache 的文件路径 /etc/apache2
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
244 245行修改为
DocumentRoot "/Users/itgoyo/Documents/www"
<Directory "/Users/itgoyo/Documents/www”>
以后 apache 的根目录就是在 www 这个文件目录下