linux apache的安装与配置 ,局域网访问主页
2014-06-03 23:44
330 查看
Apache web服务器的安装,其实主要是解决级几个依赖关系,其安装本身其实是相当的简单。但是就一般情况下,可以总结为:
1.安装apr
2.安装apr-util
3.安装apache
4.配置
5.可选项:安装subversion
# tar zxvf apr-1.3.5.tar.gz
# cd apr-1.3.5
# ./configure
#make
#make install
# cd apr-util-1.3.7
# . /configure --with-apr=/usr/local/apr
# make
# make install
# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config
# make
# make install
2)apr-util not found 解决方法:安装apr-util包
3)cannot remove `libtoolT': No such file or directory 直接忽略过。
4)configure: error: You need a C++ compiler for C++ support 解决方法: yum install -y gcc gcc-c++
5)安装以上包时,可能提示缺少pcre, 解决方法,安装pcre:
下载pcre,然后
#unzip pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install
6).安装apache时提示:configure: error: APR-util version 1.3.0 or later is required
事实上我是1.5.*,是最新版本,竟然提示版本太低。于是,我换了一个版本,果然,过了。
/usr/local/apache2/bin/apachectl start
可能出现以下问题:
a. Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
这是因为未给服务器配置名称而已,只需进入/apache2/conf/httpd.conf 中配置服务器名称ServerName 即可。
b. /etc/init.d/apachectl: line 97: lynx: command not found
这是因为lynx命令不认识,只因缺少lynx包,安装即可:yum install lynx。
2)在自己的浏览器中访问自己的主页:
//localhost// 便会出现网页提示服务器正常安装。
3)再更改服务器名称后,并在hosts中增加服务器名称与IP的映射,就可用自己的网址访问了,比如:www.myapache.com
4 )局域网访问主页:
在httpd.conf中:
在httpd.conf中将以下
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
改为
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from none
Allow from all
其实,我根本没有发现以上内容,于是我自己在httpd.con中增加了Allow from all.
但是,之后从局域网其他主机依旧无法访问。我考虑是不是防火墙的原因,于是:
service iptables stop
果然。再从局域网其他主机可以正常访问了。大功告成。当然,这时只能从IP访问,因为DNS中并没有自己的IP与网址的映射。
我尝试用nat123软件实现外网访问自己的主页,未能成功。
较为高级的配置比如listen和timeout等,其实从httpd.con中看注释已然可以知道大部分。
5.subversion的安装
subversion是一个自由开源的版本控制系统,其实就是一个特殊的文件系统。安装方法可参考。
1.安装apr
2.安装apr-util
3.安装apache
4.配置
5.可选项:安装subversion
1.安装apr
下载得到apr-1.3.5.tar.gz# tar zxvf apr-1.3.5.tar.gz
# cd apr-1.3.5
# ./configure
#make
#make install
2.安装apr-util
# tar zxvf apr-util-1.3.7.tar.gz# cd apr-util-1.3.7
# . /configure --with-apr=/usr/local/apr
# make
# make install
3.安装apache
# tar zxvf httpd-2.2.11.tar.gz# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config
# make
# make install
安装总结
其实总结起来,很简单。分别从apache官网获得以上三个包,然后解压,分别执行configure、make、makeinstall即可。只是apr-util要指定apr的路径,apache则要指定apr和apr-util的路径。安装问题总结:
1)apr not found 解决方法:安装apr包2)apr-util not found 解决方法:安装apr-util包
3)cannot remove `libtoolT': No such file or directory 直接忽略过。
4)configure: error: You need a C++ compiler for C++ support 解决方法: yum install -y gcc gcc-c++
5)安装以上包时,可能提示缺少pcre, 解决方法,安装pcre:
下载pcre,然后
#unzip pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install
6).安装apache时提示:configure: error: APR-util version 1.3.0 or later is required
事实上我是1.5.*,是最新版本,竟然提示版本太低。于是,我换了一个版本,果然,过了。
4.配置 (并实现局域网访问主页)
1)启动服务器:/usr/local/apache2/bin/apachectl start
可能出现以下问题:
a. Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
这是因为未给服务器配置名称而已,只需进入/apache2/conf/httpd.conf 中配置服务器名称ServerName 即可。
b. /etc/init.d/apachectl: line 97: lynx: command not found
这是因为lynx命令不认识,只因缺少lynx包,安装即可:yum install lynx。
2)在自己的浏览器中访问自己的主页:
//localhost// 便会出现网页提示服务器正常安装。
3)再更改服务器名称后,并在hosts中增加服务器名称与IP的映射,就可用自己的网址访问了,比如:www.myapache.com
4 )局域网访问主页:
在httpd.conf中:
在httpd.conf中将以下
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
改为
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from none
Allow from all
其实,我根本没有发现以上内容,于是我自己在httpd.con中增加了Allow from all.
但是,之后从局域网其他主机依旧无法访问。我考虑是不是防火墙的原因,于是:
service iptables stop
果然。再从局域网其他主机可以正常访问了。大功告成。当然,这时只能从IP访问,因为DNS中并没有自己的IP与网址的映射。
我尝试用nat123软件实现外网访问自己的主页,未能成功。
较为高级的配置比如listen和timeout等,其实从httpd.con中看注释已然可以知道大部分。
5.subversion的安装
subversion是一个自由开源的版本控制系统,其实就是一个特殊的文件系统。安装方法可参考。
相关文章推荐
- Linux下Apache配置局域网访问出现的问题
- wxzh001,进来看关于APACHE+PHP+MYSQL+SSL的LINUX下安装配置(转自奥索)
- Apache+php+mysql在Linux下的安装与配置
- Linux下安装配置 Jdk1.6+Tomcat6+Apache2.2.x+jk_mod1.2 详解
- LINUX下用apache,本机可以访问,但局域网中的电脑无法访问
- apache 局域网访问配置方案第1/2页
- Linux下Apache 2.2, MySQL 5.0和PHP 5.0的安装与配置
- Apache+php+mysql在Linux下的安装与配置
- 详解linux系列之字符界面安装apache及配置
- 详解linux系列之字符界面安装apache及配置
- Linux下Apache2.0简单安装、配置、测试过程
- LINUX系统下apache+svn服务器安装配置全过程
- apache```局域网访问配置方案
- linux下apache的安装、配置
- Linux下Apache的安装与配置
- linux PHP Apache Mysql 安装 配置
- linux下安装apache与php;Apache+PHP+MySQL配置攻略
- Linux下apache+svn的安装与配置
- linux下apache的安装配置
- Linux下Apache2.2,MySQL6.0和PHP5.2的安装与配置