linux打开80端口及80端口占用解决办法
linux打开80端口
天客户那边有台服务器同一个局域网中都无法访问,排除lamp环境问题,发现时服务器中的防火墙没有开启80端口。
代码如下 复制代码
vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火墙)
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允许3306端口通过防火墙)
按照这种方法测试,发现重启防火墙的时候,回报这两行错误。
[root@localhost ~]# /etc/init.d/iptables restart
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
iptables:应用防火墙规则:Bad argument `–-state'
Error occurred at line: 11
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
[失败]
发现这种方法并不好使,于是尝试另外一种,通过命令去添加端口的方法。
代码如下 复制代码
[root@centos httpd]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@centos httpd]# /etc/rc.d/init.d/iptables save
[root@centos httpd]# /etc/init.d/iptables restart
这样就搞定了,查看效果
代码如下 复制代码
[root@centos httpd]# /etc/init.d/iptables status
Linux下启动apache报错:80端口已占用解决办法
apache启动报错(98)Address already in use: make_sock: could not bind to address [::]:80
# /etc/init.d/httpd start
Starting httpd: (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
[FAILED]
代码如下 复制代码
1.netstat -lnp|grep 80
tcp 0 0 192.168.180.68:61027 0.0.0.0:* LISTEN 6289/oproxyd
tcp 0 0 :::80 :::* LISTEN 846/httpd
tcp 0 0 ::ffff:192.168.180.68:7001 :::* LISTEN 32015/java
找到pid 846
#ps 846
查看
#kill -9 846
杀掉
#./apachectl start
启动成功
*****************************************************************************
处理办法:
代码如下 复制代码
# ps -aux | grep http
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 12079 0.0 0.0 61164 720 pts/1 S+ 16:06 0:00 grep http
# ps -aux | grep apache
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
apache 10820 0.0 0.0 2044 600 ? Ss Jan01 0:04 bash
root 12081 0.0 0.0 61160 716 pts/1 S+ 16:06 0:00 grep apache
# kill -9 10820
# /etc/init.d/httpd start
Starting httpd: [ OK ]
# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
linux打开80端口及80端口占用解决办法的更多相关文章
- 80端口被系统进程PID-4占用解决办法
今天因为工程需要就把tomcat服务器的端口改成了80了,可是一启动就出现问题了 发现报错信息是端口占用了,于是我马上就在了命令行敲入了netstat -ano查看端口占用情况 终于发现是PID为4的 ...
- Android学习之 adb被占用解决办法
1.adb被占用解决办法 方法一:(1)查看5037端口哪个进程在用 netstat -a -o 5037 (2)查看上面进程是哪个执行文件在占用 tasklist ...
- ubuntu Linux 测试PHP却提示下载文件的解决办法
ubuntu Linux 测试PHP却提示下载文件的解决办法 一般这种情况都是在刚刚开始配置环境时出现的, 输入 sudo a2enmod php5 看提示如果出现“$ This module ...
- 嵌入式X86运行linux及QtEmbedded+触摸屏(X86PC104+Xlinux+QtE+触摸屏解决办法)
嵌入式X86运行linux及QtEmbedded+触摸屏(X86PC104+Xlinux+QtE+触摸屏解决办法) QQ:5724308 邮箱:sankye@163.com
- linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法
linux中没有dos2UNIX或者UNIX2dos命令怎么解决办法 http://blog.csdn.net/w616589292/article/details/38274475 dos2unix ...
- xampp 80端口被占用解决办法
很多朋友安装xampp之后,启用服务器或者数据库失败,发现端口已经被占用.因为每台电脑占用端口的软件不一样,要如何解决这个问题. 第一种解决方法: 检查软件安装路径中是否有中文,如下图: 解决方法: ...
- win10下端口被占用解决办法
调试socket通信的时候,如果程序未正常结束,重新启动会报端口被占用的错误. 一 查找被占用的端口 解决办法如下:按win+R输入cmd打开控制台,输入 netstat -ano|findstr 8 ...
- Netty+Tomcat热部署端口占用解决办法(转)
在eclipse使用maven deploy (tomcat:deploy) 热部署netty项目 ,项目启动的时候会报错端口被占用. java.net.BindException: Address ...
- linux 删除文件后空间没有释放的解决办法
清空没用的文件,当我删除文件后,发现可用空间沒有变化 os:centos4.7 现象: 发现当前磁盘空间使用情况: [root@ticketb ~]# df -hFilesystem ...
随机推荐
- for循环删除list元素陷阱
首先我们先看一段代码,如下: List<String> list=new ArrayList<String>(); list.add("123"); lis ...
- 单源最短路径 hdu 2066
#include<string.h> //和prim类似#include<stdio.h> //prim所考虑的是节点与当前所建成的树的距离最小using namespace ...
- [BZOJ3561] DZY Loves Math VI
(14.10.28改) 本来只想写BZOJ3739:DZY Loves Math VIII的,不过因为和VI有关系,而且也没别人写过VI的题解,那么写下. 不过我还不会插公式…… http://www ...
- 转载:JAVA中使用JSON进行数据传递
转载网址:http://www.cnblogs.com/undead/archive/2012/07/18/2594900.html 最近在做一个基于JAVA Servlet的WEB应用以及对应的An ...
- 一个基础的CURL类
/** * 一个基础的CURL类 * * @author Smala */ class curl{ public $ch; public $cookie = '/cookie'; public $rs ...
- Android面试题(文章内容来自他人博客)
腾讯面试题 1.int a = 1; int result = a+++3<<2; 2.int a = 2; int result = (a++ > 2)?(++a):(a+=3); ...
- 如何使用git创建项目,创建分支
git config -global user.name "Your name" git config -global user.email "you@example.c ...
- [poj 1364]King[差分约束详解(续篇)][超级源点][SPFA][Bellman-Ford]
题意 有n个数的序列, 下标为[1.. N ], 限制条件为: 下标从 si 到 si+ni 的项求和 < 或 > ki. 一共有m个限制条件. 问是否存在满足条件的序列. 思路 转化为差 ...
- logstash match
[elk@zjtest7-frontend config]$ cat stdin04.conf input { stdin { } } filter { # drop sleep events gro ...
- /sbin/ifup: configuration for eth0 not found解决
/sbin/ifup: configuration for eth0 not found. Usage: ifup <device name> 那么应该是在/etc/sysconfig/n ...