在Ubutu12.04上构建apache2服务器

来源:互联网 发布:ssh的端口号 编辑:程序博客网 时间:2024/05/29 19:20

 安装 Apache2

  sudo apt-get install apache2

在浏览器输入你服务器ip地址列入,如http://**.**.**.**。查看Apache2是否工作,如果显示(It works!),说明已经工作。

Apache 在 Ubuntu 中默认文档根目录为 /var/www,配置文件 /etc/apache2/apache2.conf,额外配置存储子目录 /etc/apache2

 

Apache2配置

1.重启服务器:/etc/init.d/apache2 restart

2.关闭apache2服务器:/etc/init.d/apache2 stop

3.开启apache2服务器:/etc/init.d/apache2 start

4.修改默认文档根目录方法:(1)sudo gedit /etc/apache2/sites-enabled/000-default

              (2)在文档中找到 DocumentRoot 在后面修改你要放置网页文件的目录

              (3)重启apache服务器


文件下载

cd  /var/www

sudo mkdir download

sudo cp ~/**.zip ./download

sudo vim index.html 向index.html中添加 <a href="download/**.zip">patch</a>

然后在输入网址 http://**.**.**.**就可以看见下载的链接了,点击就可以下载了。


0 0
原创粉丝点击