Ubuntu12.04下安装Apache
2013-06-30 22:33
330 查看
提示:本教程使用的是Apache编译安装的方式,相对而言较困难,对于初学者,建议直接使用ubuntu的安装包管理工具apt-get命令安装:
sudo apt-get install apache2
在安装Apache之前,必须要安装它所依赖的类库,如下步骤本人亲测,注意下载上面提到的包时需解压,下面的命令都是在进入解压后的目录下执行的。
这里的--prefix表示设置安装目录.
4.1安装APR
4.2安装APR-util
进入apache的bin目录,执行命令:
测试配置信息是否正确,这时会出现一个错误:httpd: Could not reliably determine the server's fully qualified domain name:
解决办法,输入如下命令:
打开gedit编辑器,修改httpd.conf文件,将里面的大概187行#ServerName www.example.com:80 注释去掉并改为ServerName localhost:80即可,参考:http://www.cnblogs.com/52linux/archive/2012/03/24/2415637.html
再次运行:sudo ./apachectl configtest,提示:Syntax OK
启动服务:
对应停止命令为stop, 重启为restart。
运行start命令后,在浏览器中输入http://localhost,出现如下页面就说明Apache安装成功:
这里运行的页面为<apach安装目录>/htdocs目录下的index.html文件,从这可知,htdocs为Apache默认的web根目录。
http://www.51testing.com/?uid-350678-action-viewspace-itemid-812385
sudo apt-get install apache2
在安装Apache之前,必须要安装它所依赖的类库,如下步骤本人亲测,注意下载上面提到的包时需解压,下面的命令都是在进入解压后的目录下执行的。
1.安装libtool
从http://www.gnu.org/software/libtool/下载libtool./configure make sudo make install
2.安装expat
从http://sourceforge.net/projects/expat/下载expat,XML Parser./configure make sudo make install
3.安装pcre
从http://pcre.org/下载pcre(Perl Compatible Regular Expressions)依赖库./configure --prefix=/usr/local/pcre make sudo make install
这里的--prefix表示设置安装目录.
4.安装APR(Apache Portable Runtime)
从http://apr.apache.org/download.cgi处下载APR 1.4.6与APR-util 1.5.24.1安装APR
./configure --prefix=/usr/local/apr make sudo make install
4.2安装APR-util
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make sudo make install
5.安装Apache
从Apache的官网http://httpd.apache.org/下载最近的Apache服务器包,我下载的是最新的httpd-2.4.4.tar.gz,2.4.4版。./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre make sudo make install
6.检证安装
检查配置是否正常,输入如下命令:cd /usr/local/apache2/bin
进入apache的bin目录,执行命令:
sudo ./apachectl configtest
测试配置信息是否正确,这时会出现一个错误:httpd: Could not reliably determine the server's fully qualified domain name:
解决办法,输入如下命令:
sudo gedit ../conf/httpd.conf
打开gedit编辑器,修改httpd.conf文件,将里面的大概187行#ServerName www.example.com:80 注释去掉并改为ServerName localhost:80即可,参考:http://www.cnblogs.com/52linux/archive/2012/03/24/2415637.html
再次运行:sudo ./apachectl configtest,提示:Syntax OK
启动服务:
sudo ./apachectl start
对应停止命令为stop, 重启为restart。
运行start命令后,在浏览器中输入http://localhost,出现如下页面就说明Apache安装成功:
这里运行的页面为<apach安装目录>/htdocs目录下的index.html文件,从这可知,htdocs为Apache默认的web根目录。
附:参考网址:
http://chinaapp.sinaapp.com/thread-419-1-1.htmlhttp://www.51testing.com/?uid-350678-action-viewspace-itemid-812385
相关文章推荐
- Ubuntu12.04下手动配置安装apache+php+mysql
- Ubuntu12.04 安装apache+php+mysql服务器
- ubuntu12.04下apt-get install安装Apache+PHP+Mysql
- Ubuntu12.04上安装mono,Jexus和apache
- Ubuntu12.04下安装apache2.4过程(源代码编译安装方式)
- ubuntu12.04安装subversion并配置nginx+apache通过http方式访问
- ubuntu12.04安装apache2.4
- Ubuntu12.04下apache服务器的安装也配置
- ubuntu12.04安装php+apache+mysql并安装laravel-4.x
- ubuntu12.04――安装apache,配置调用cgi
- Ubuntu 下 Apache、php、mysql默认安装路径(以Ubuntu12.04为例)
- ubuntu12.04下编译安装lamp(apache2.2.26 mysql5.5.36 php5.2.17)环境
- Ubuntu12.04下安装PHP、MySQL和Apache
- ubuntu12.04下安装Apache+PHP+MySQL
- Ubuntu12.04下安装配置apache+php+mysql+pear(MDB2)开发环境
- Ubuntu12.04 LTS 中安装JAVA6
- lamp黄金组合apache+mysql+php的安装
- Ubuntu12.04安装java以及Eclipse和Tomcat
- ubuntu12.04 安装配置jdk1.7
- ubuntu12.04(64位) 安装配置jdk1.7