Ubuntu下apache环境搭建
来源:互联网 发布:java软件开发培训机构 编辑:程序博客网 时间:2024/05/21 04:01
1简介
Apache是世界排名第一的web服务器软件,它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。Apache可以用来搭建ipv6环境的http服务器。
2下载apache源码编译安装
2.1到官网(http://httpd.apache.org/download.cgi)上下载稳定最新的apache版本;
如:httpd-2.4.18.tar.gz
解压 :#tar -zxvf httpd-2.4.18.tar.gz
接下来进行编译:
先生成Makefile文件:# ./configure --prefix=/root/soft/apache/
如果顺利完成(说明你之前安装过apache环境,直接make &makeinstall,跳过下列步骤);如果报错:
checking for APR... noconfigure: error: APR not found. Pleaseread the documentation.
则说明缺少一些准备环境,需要安装另外一个东西 APR(ApachePortable Runtime)
下载地址: http://archive.apache.org/dist/apr/ 同样找最新版本
apr-1.4.5.tar.gz
解压:#tar –zxvf apr-1.4.5.tar.gz
编译:
# ./configure –prefix=/root/soft/apr/
#make
#make install
接下来继续安装:
# ./configure --prefix=/root/soft/apache/ --with-apr=/root/soft/apr/
(加上--with-apr=/root/soft/apr是为了告诉apache已经安装好apr环境了)
继续报错:
checking for APR-util... no
configure: error: APR-util not found. Pleaseread the documentation.
不过这次的错误是错少apr-util
下载apr-util:http://archive.apache.org/dist/apr/
得到文件:apr-util-1.5.2.tar.gz
解压: #tar -zxvfapr-util-1.5.2.tar.gz
# ./configure --prefix=/root/soft/apr-util/
这样编译会遇到错误,因为apr-util需要apr环境,所以要加上apr的编译环境
# ./configure --prefix=/root/soft/apr-util/ --with-apr=/root/soft/apr/
#make
#make install
再转回去继续安装apache:
(相信你已经懂了接下来的编译命令)
# ./configure --prefix=/root/soft/apache/ --with-apr=/root/soft/apr/
--with-apr-util=/root/soft/apr-util/
继续报错:
checking for pcre-config... false
configure: error: pcre-config for libpcre notfound. PCRE is required and available fromhttp://pcre.org/
还是缺少环境:下载pcre
下载地址: http://jaist.dl.sourceforge.net/project/pcre/pcre/
得到文件:pcre-8.38.tar.gz
解压:#tar -zxvf pcre-8.38.tar.gz
编译:# ./configure –prefix=/root/soft/pcre/
如果报错:
checking for windows.h... no
configure: error: You need a C++ compiler for C++support.
说明你没有C++编译器,可以通过命令(#apt-get install build-essential)安装
接下来:
#make
#make install
继续apache的安装:
# ./configure --prefix=/root/soft/apache/ --with-apr=/root/soft/apr/
--with-apr-util=/root/soft/apr-util/ --with-pcre=/root/soft/pcre/
顺利生成Makefile文件
# make
# make install
安装成功。
3测试apache
3.1修改配置文件:
#vi/root/soft/apache/conf/httpd.conf
找到ServerName那行
修改为:ServerName127.0.0.1:80
3.2 开启apache服务:
进入目录:# cd/root/soft/apache/bin
运行:# ./apachectl start
通过浏览器访问地址:127.0.0.1可以看到apache自带页面:
It works
3.3 关闭apache服务:
# ./apachectl stop
4测试异常情况
4.1访问127.0.0.1没有出现默认出现的页面,出现403错误(禁止访问)
一个可能情况为:你没有对apache放置访问文件的一整个目录赋予可执行的权限(即x权限),如,放置文件的目录为:/root/soft/apache/htdocs/index.html ,可用(# ls –ld /root/)查看目录的权限,你需要逐级对每个目录赋予可执行的权限(# chmod –R 755 /root/soft/apache/htdocs/),目录下的文件同理也需要x权限。
注:一定要确保每一级目录都有执行权限
5使用
5.1配置ubuntu里ipv6地址,可用命令:
ifconfig eth0 inet6 add XXXX:XXXX:XXXX:XXXX::XXXX
5.2修改配置文件:
# vi /root/soft/apache/conf/httpd.conf
加入监听的地址:Listen XXXX:XXXX:XXXX:XXXX::XXXX:8080
端口选择8080的原因是因为防止与原来的端口冲突
5.3将文件放入配置文件里默认的访问地址:/root/soft/apache/htdocs/就可以了
参考:http://blog.csdn.net/yiluoak_47/article/details/22067185
- Ubuntu下apache环境搭建
- Ubuntu下搭建SVN环境-Apache
- ubuntu下Apache+mysql+php环境搭建
- ubuntu 下 搭建 python+apache+django+mysql web开发环境
- Ubuntu下搭建PHP开发环境(Apache+Mysql+PHP5)
- Ubuntu下搭建PHP开发环境(Apache+Mysql+PHP5)
- Ubuntu下(Linux+Apache+MYSQL+PHP, LAMP)环境搭建
- Ubuntu下LAMP环境搭建 Apache、MySQL、PHP
- ubuntu下搭建apache+gerrit+h2+git环境
- Ubuntu下LAMP环境搭建 Apache、MySQL、PHP
- Ubuntu下LAMP环境搭建 Apache、MySQL、PHP
- Ubuntu下LAMP环境搭建 Apache、MySQL、PHP
- Ubuntu下搭建SVN+Apache
- Linux下 apache环境搭建
- Ubuntu上搭建 Apache + PHP + MySQL 环境
- ubuntu 搭建 lamp 环境php mysql apache
- Ubuntu上搭建 Apache + PHP + MySQL 环境
- Ubuntu+Apache上搭建CGI开发环境
- CodeForces 21 C Stripe 2
- Linux 下编译链接动静态库
- 阿里云上安装Git
- 你不知道的JavaScript--Item37 面向对象高级程序设计
- Swift UITextField/UITextView(placeholder的制作)
- Ubuntu下apache环境搭建
- 关于友盟推送收不到消息,有可能是用的不是友盟的V4包
- 嵌入式linux:LIBRARY_PATH和LD_LIBRARY_PATH环境变量的区别
- map排序
- 修改HTML元素
- CodeForces 21 D Traveling Graph
- 为什么蠢货才能在澳大利亚生存
- 一个关于时间的静态变量的应用
- 2016蓝桥杯B组——NO.3