shok 发表于 2015-11-3 15:59:30

请教下为何打不开apache的测试页面

用RPM包安装的apache,这个虚拟机上网需要用代理地址10.87.13.69:8080,虚拟机的eth0设置IP是192.168.137.2,用的是共享IP上网的。
apache可以正常启动,也监听了8080端口,防火墙关了,selinux改为SELINUX=disabled了
# ps -ef | grep httpd
root   19607   10 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19610 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19611 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19612 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19613 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19614 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19615 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19616 196070 15:28 ?      00:00:00 /usr/sbin/httpd
apache   19617 196070 15:28 ?      00:00:00 /usr/sbin/httpd
root   19619 195300 15:28 pts/0    00:00:00 grep httpd
# netstat -tlnp | grep httpd
tcp      0      0 192.168.137.2:8080          0.0.0.0:*                   LISTEN      19607/httpd         
# iptables -L
Chain INPUT (policy ACCEPT)
target   prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target   prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target   prot opt source               destination         
# vim /etc/sys
sysconfig/          sysctl.conf         system-release      system-release-cpe
# vim /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#   targeted - Targeted processes are protected,
#   mls - Multi Level Security protection.
SELINUXTYPE=targeted


下面是我自己更改过的地方,是不是有问题啊?
vim /etc/httpd/conf/httpd.conf
Listen 192.168.137.2:8080
ServerName xili:8080


vim /etc/hosts
"/etc/hosts" 3L, 123C                                                                                                                                     1,1          全部
127.0.0.1   xili
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.2 www.xili.com


我在浏览器输入的 192.168.137.2提示

技术信息(提供给支持人员)
[*]错误代码 10060: 连接超时
[*]背景信息: 网关不能从您要访问的网站接收到及时响应。这可能表明网络阻塞,或者该网站遇到技术困难。
[*]日期: 2015/11/3 7:56:56
[*]服务器: HQTMG03
[*]源: 防火墙




我的真实机器上装的有赛门铁克的防火墙,是跟这个有关系么?

1307077801 发表于 2015-11-3 17:33:16

可以先从本机测试,用命令curl 或elinks
这样就首先可以排除远程访问的问题

sky 发表于 2015-11-3 18:20:31

telnet 192.168.137.2 8080 试试通不通,另外你开启的是8080端口为什么会访问192.168.137.2呢,为啥访问的不是192.168.137.2:8080

shok 发表于 2015-11-4 11:11:57

用curl -x 10.87.13.69:8080 http://www.iyunv.com会出现好多东西例如
<div id="footer"><P align="center">
<a href="http://www.iyunv.com/aboutus.htm">Linux公社简介</a> - <a href="http://www.iyunv.com/adsense.htm">广告服务</a> - <a href="http://www.iyunv.com/sitemap.aspx">网站地图</a> - <a href="http://www.iyunv.com/help.htm">帮助信息</a> - <a href="http://www.iyunv.com/contactus.htm">联系我们</a><br />本站(iyunv)所刊载文章不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。<br /><script type="text/javascript" language="javaScript" src="/linuxfile/qq.js"></script><br />
本站带宽由[<a href="http://www.6688.cc"><font color="red">6688.CC</font></A>]友情提供及技术支持<br>关注Linux,关注iyunv.com,<font color="red">请向您的QQ好友宣传iyunv.com</font>,多谢支持!<br /><A title=Ubuntu href="topicnews.aspx?tid=2">Ubuntu专题</A> <A title=Fedora href="topicnews.aspx?tid=5">Fedora专题</A> <A title=Android href="topicnews.aspx?tid=11">Android专题</A> <A title=Oracle href="topicnews.aspx?tid=12">Oracle专题</A> <A title=Hadoop href="topicnews.aspx?tid=13">Hadoop专题</A> <A title=SUSE href="topicnews.aspx?tid=3">SUSE专题</A> <A title=红旗Linux href="topicnews.aspx?tid=1">红旗Linux专题</A> <A title=RedHat href="topicnews.aspx?tid=10">RedHat专题</A> <A title=CentOS href="topicnews.aspx?tid=14">CentOS专题</A><br />Copyright © 2006-2015 <a href="http://www.iyunv.com/">Linux公社</a> All rights reserved 沪ICP备15008072号-1</P>




</div>
</div>
<script type="text/javascript">linkSize();StartRollV();</script>
<script type="text/javascript" language="javaScript" src="/linuxren/linuxren3.js"></script>
</body>
</html>
# curl -x 10.87.13.69:8080 http://www.iyunv.com | less
% Total    % Received % XferdAverage Speed   Time    Time   TimeCurrent
                                 DloadUpload   Total   Spent    LeftSpeed
110   221    0   221    0   0    160      0 --:--:--0:00:01 --:--:--   161<U+FEFF>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<title>Linux公社 - Linux系统门户网站</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<link rel="icon" href="favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<meta name="description" content="Linux公社(www.iyunv.com)是专业的Linux系统门户网站,实时发布最新Linux资讯,包括Linux、Ubuntu、Fedora、RedHat、红旗Linux、Linux教程、Linux认证、SUSE Linux、Android、Oracle、Hadoop等技术。"/>
<meta name="keywords" content="Linux,Ubuntu,Fedora,RedHat,红旗Linux,Linux教程,Linux系统,Linux安装,SUSE Linux,Android,Oracle"/>
<link rel="canonical" href="http://www.iyunv.com/"/>
<meta name="generator" content="Linux公社"/>
<meta name="generator" content="Linux"/>
<link rel="stylesheet" href="style/linux/style.css" type="text/css"/>
<meta name="generator" content="专业的Linux网站"/>
<script type="text/javascript" src="inc/jquery.js"></script>
<script type="text/javascript" src="inc/iwms.js"></script>
<link rel="alternate" type="application/rss+xml" title="Linux公社 - Linux系统门户网站" href="rssFeed.aspx"/>
<meta name="baidu-site-verification" content="JHfXFJc1V4" />
</head>


<body>
这是不是说明是可以访问的?

shok 发表于 2015-11-4 11:17:27

sky 发表于 2015-11-3 18:20
telnet 192.168.137.2 8080 试试通不通,另外你开启的是8080端口为什么会访问192.168.137.2呢,为啥访问的 ...

额,新手,很多不太懂~~~~
# telnet 192.168.137.2:8080
telnet: 192.168.137.2:8080: Name or service not known
192.168.137.2:8080: Unknown host


不能telnet通,如何解决啊?

shok 发表于 2015-11-4 11:25:10

本帖最后由 shok 于 2015-11-4 11:32 编辑

刚才Ping了下 ping不通
# ping -c 10 www.baidu.com
PING www.a.shifen.com (111.13.100.92) 56(84) bytes of data.

--- www.a.shifen.com ping statistics ---
10 packets transmitted, 0 received, 100% packet loss, time 19006ms

可是机器可以用yum,证明应该是可以联网的啊?
# yum -y install mysql
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
解决依赖关系
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> 执行事务检查
---> Package mysql.i686 0:5.1.73-5.el6_6 will be 安装
--> 处理依赖关系 mysql-libs = 5.1.73-5.el6_6,它被软件包 mysql-5.1.73-5.el6_6.i686 需要
--> 执行事务检查
---> Package mysql-libs.i686 0:5.1.73-3.el6_5 will be 升级
---> Package mysql-libs.i686 0:5.1.73-5.el6_6 will be an update
--> 完成依赖关系计算

依赖关系解决

============================================================================================================================================================================
软件包                                     架构                                 版本                                          仓库                                  大小
============================================================================================================================================================================
正在安装:
mysql                                    i686                                 5.1.73-5.el6_6                                  base                                 904 k
为依赖而更新:
mysql-libs                                 i686                                 5.1.73-5.el6_6                                  base                                 1.2 M

事务概要
============================================================================================================================================================================
Install       1 Package(s)
Upgrade       1 Package(s)

总文件大小:2.1 M
总下载量:904 k
下载软件包:
mysql-5.1.73-5.el6_6.i686.rpm                                                                                                                        | 904 kB   00:04   
运行 rpm_check_debug
执行事务测试
事务测试成功
执行事务
正在升级   : mysql-libs-5.1.73-5.el6_6.i686                                                                                                                           1/3
正在安装   : mysql-5.1.73-5.el6_6.i686                                                                                                                              2/3
清理       : mysql-libs-5.1.73-3.el6_5.i686                                                                                                                           3/3
Verifying: mysql-5.1.73-5.el6_6.i686                                                                                                                              1/3
Verifying: mysql-libs-5.1.73-5.el6_6.i686                                                                                                                           2/3
Verifying: mysql-libs-5.1.73-3.el6_5.i686                                                                                                                           3/3

已安装:
mysql.i686 0:5.1.73-5.el6_6                                                                                                                                             

作为依赖被升级:
mysql-libs.i686 0:5.1.73-5.el6_6   
ping 单位的宿主机是可以Ping通的
# ping 10.88.130.147
PING 10.88.130.147 (10.88.130.147) 56(84) bytes of data.
64 bytes from 10.88.130.147: icmp_seq=1 ttl=63 time=0.808 ms
64 bytes from 10.88.130.147: icmp_seq=2 ttl=63 time=0.758 ms
64 bytes from 10.88.130.147: icmp_seq=3 ttl=63 time=0.707 ms
64 bytes from 10.88.130.147: icmp_seq=4 ttl=63 time=0.660 ms
^C
--- 10.88.130.147 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3339ms
rtt min/avg/max/mdev = 0.660/0.733/0.808/0.058 ms                                                                                                                                    

cheng029 发表于 2015-11-6 14:14:48

你解决了吗?你apache启用的是8080端口,你访问8080端口啊

shok 发表于 2015-11-6 15:15:35

admin 发表于 2015-11-6 14:14
你解决了吗?你apache启用的是8080端口,你访问8080端口啊

还没有好啊,在浏览器输入http://192.168.137.2:8080/提示   504 网关超时等待服务器响应时网关超时过期

在虚拟几上ping真实机器的IP10.88.132.135,可以ping通,真实机是可以上网的。我在虚拟机上ping www.baidu.com也没有Ping通,请教是什么原因啊

sunzhongyu 发表于 2015-11-7 10:32:33

servername后面还带端口号?
页: [1]
查看完整版本: 请教下为何打不开apache的测试页面