CentOS6.5 安装Apache

5 篇文章 0 订阅

shell># cd /home/jinnan/tar

shell># tar -jxvf httpd-2.2.19.tar.bz2

shell># cd httpd-2.2.19

shell>#./configure --prefix=/usr/local/http2  \

        --enable-modules=all \

        --enable-mods-shared=all \

        --enable-so

shell># make && make install

 

启动Apache

shell># /usr/local/http2/bin/apachectl start/stop/restart

 

报错:

[root@study http2]# bin/apachectl start

(98)Address already in use: make_sock: could not bind to address [::]:80

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

no listening sockets available, shutting down

Unable to open logs

解决方法:更改httpd.conf监听的端口为8080

 

重启httpd 服务 不报错,但是不执行

shell># service  httpd  restart

shell># /usr/local/http2/bin/apachectl restart 不报错

 

查看Apache的error_log日志

shell># cat /usr/local/http2/logs/error_log

报错内容如下:

[Wed Aug 29 15:33:51 2018] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "study"

Configuration Failed

 

百度翻译:名称解析的临时失败:MMOTUnQuiGID:无法找到“study”的IPv4地址

解决方法:

vi /etc/hosts

#add line

127.0.0.1 name #我这里的name是study

Linux系统打开浏览器,输入127.0.0.1:8080,显示it works!

系统内部可以访问,虚拟机外却不可以访问,执行shell>#Service  iptables  status

检查发现linux系统的8080端口未开放

1.开放Linux的8080端口

shell># vi /etc/sysconfig/iptables

进入编辑页面,在指定位置新增以下配置

-A  INPUT  -m  state  --state  NEW  -m  tcp  -p  tcp  --dport  8080  -j  ACCEPT

这句要放在 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 后面

2.修改完保存退出,重启网卡服务

shell>#service  iptables  restart

3.查看端口开放信息

shell>#Service  iptables  status

482178-20170323120503783-1352764757.png

非虚拟机系统,可以用站长工具的端口扫描查看端口是否开发

站长工具地址:http://tool.chinaz.com/port/ 

 

修改Apache的默认访问目录

 

第一步打开配置文件

shell># vi /usr/local/http2/conf/httpd.conf

第二步修改配置内容

#DocumentRoot "/usr/local/http2/htdocs"

DocumentRoot "/mnt/workspace"

 

#<Directory "/usr/local/http2/htdocs">

<Directory "/mnt/workspace">

    注:如果默认访问的新地址是在/home目录下,则要修改:

User daemon

Group daemon

#User home目录下的用户名

#Group  用户名所在的组名

    并且要注意访问的权限问题

第三步重启Apache服务器

shell># ./apachectl restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值