Ubuntu 安装 Apache2
1. 设置主机名称及 IP
sudo vi /etc/hosts
加入下列格式信息
10.0.0.1 bbs.52ij.com bbs
2.安装 Apache2
sudo apt-get install apache2
程序会安装在 /etc/apache2
3.修改设置档
sudo vi /etc/apache2/apache2.conf
4.上传文件到 /var/www
5.启动 apache2
sudo /etc/init.d/apache2 start
6.停止 apache2
sudo /etc/init.d/apache2 stop
7. 重启 apache2
sudo /etc/init.d/apache2 restart
8.重新载入设置档
sudo /etc/init.d/apache2 reload
在装好 Apache2 之后,Apache2 的设置档会存放在 /etc/apache2 文件夹下,在这个文件夹里面有一个 apache2.conf 的文件,这个 apache2.conf 文件是针对整个 Apache2 的设置档, 一般来说是不用去动它的,如果要调设置的话,是要到 /etc/apache2/sites-available 里去调的,默认的网站是调 /etc/apache2/sites-available/default 这个文件,而这个文件相当于在 centos 上的 httpd.conf 档
另外,你可能会发现,在 /etc/apache2 文件夹里,除了有 /etc/apache2/sites-available 文件夹之外,还有一个长的很像的 /etc/apache2/sites-enabled 文件夹,这二个文件夹有什么不同吗 ?
其实是有的,只要是在 sites-available 文件夹的设置档有用 a2ensite 指令启用过的虚拟主机,就会被在 sites-enabled 文件夹来建立一个连回到 sites-available 文件夹设置档的链结,来让 Apache 知道那些设置档有启用了。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
