linux打开端口
客户那边有台服务器同一个局域网中都无法访问,排除lamp环境问题,发现时服务器中的防火墙没有开启80端口。于是去网上搜索了一下,在脚本之家看到一种添加代码的方法
| 代码如下 | 复制代码 |
|
vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火墙) |
|
按照这种方法测试,发现重启防火墙的时候,回报这两行错误。
[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打开端口的更多相关文章
- Linux 打开端口方法
关闭防火墙:service iptables stop 开启防火墙:service iptables start 防火墙状态:service iptables status 永久关闭:chkconfi ...
- linux打开80端口及80端口占用解决办法
linux打开80端口天客户那边有台服务器同一个局域网中都无法访问,排除lamp环境问题,发现时服务器中的防火墙没有开启80端口. 代码如下 复制代码vi /etc/sysconfig/iptable ...
- Linux打开防火墙telnet端口
检查端口情况:netstat -an | grep 22 关闭端口号:iptables -A INPUT -p tcp --drop 端口号-j DROP ipt ...
- 查看Linux下端口占用情况的命令
在使用Linux系统的过程中,有时候会遇到端口被占用而导致服务无法启动的情况.比如HTTP使用80端口,但当启动Apache时,却发现此端口正在使用. 这种情况大多数是由于软件冲突.或者默认端口设置不 ...
- linux 查看端口被占用
linux 查看端口被占用 1.lsof -i : 端口号 用于查看某一端口的占用情况,比如查看8080端口使用情况,lsof -i:8080 如果执行 lsof -i:8080 系统提示 : ...
- Linux通过端口转发来访问内网服务(端口转发访问阿里云Redis数据库等服务)
# 安装rinetd wget http://www.boutell.com/rinetd/http/rinetd.tar.gz&&tar -xvf rinetd.tar.gz& ...
- window与linux查看端口被占用
本文摘写自: 百度经验 https://www.cnblogs.com/ieayoio/p/5757198.html 一.windows:开始---->运行---->cmd,或者是wind ...
- linux 常用端口【转载】
原文地址: http://blog.csdn.net/u013943420/article/details/65938696 一个计算机最多有65535个端口,端口不能重复.这65536个端口被分为两 ...
- windows、Linux 开放端口
一.Linux开放端口: 1. CentOS7.x/RedHat7.x , 参考 CentOS7使用firewalld打开关闭防火墙与端口 1.firewalld的基本使用 启动: systemct ...
随机推荐
- NULL值比较,两个列的合并,列值按条件替换。
show create table 表名 -- 显示创建表的sql语句. 为已有的表增加新列.alter table 表名 add 列名 int NULL -- 此行加了一个int 类型 默认可以nu ...
- Mac OS X Server 安装与应用
Mac OS X Server 安装与应用 Mac OS X Server是苹果电脑公司新一代服务器软件.专为OS X和iOS设备.Mac OS X提供服务,现在支持Mavericks,能够轻松共享文 ...
- IP配置
1: #vi /etc/sysconfig/network-scripts/ifcfg-eth0 2: 实验环境-网络设置 公司域网: IP=162.168.16.0/24 netmask=255.2 ...
- Android WebRTC 音视频开发总结(四)-- webrtc传输模块
在介绍WebRTC通讯之前我们先来看一个P2P视频聊天包括的主要过程,转载请说明出处(博客园RTC.Blacker): 音视频数据采集->编码->发送->接收->解码-> ...
- HLS入门收集(1)
使用HLS各种问题 关于求指数函数 exp(x) 在HLS中使用exp(x),也就是指数函数.不能导出RTL到EDK也就是Pcore 只能导出为VIVADO IP:相关解释:见官方论坛 http:/ ...
- css3- border
css3-border 1.border-color 2.border-image 3.border-radius ( none | <length>{1,4} [ / <leng ...
- css3 文本效果
CSS3 文本效果 1 CSS3 文本阴影在 CSS3 中,text-shadow 可向文本应用阴影,能够规定水平阴影.垂直阴影.模糊距离,以及阴影的颜色.text-shadow: 5px 5px ...
- Git客户端图文详解如何安装配置GitHub操作流程攻略
收藏自 http://www.ihref.com/read-16377.html Git介绍 分布式 : Git版本控制系统是一个分布式的系统, 是用来保存工程源代码历史状态的命令行工具; 保存点 : ...
- a标签至于flash之上的时候,IE浏览器无法点击连接的问题
<a style="display: block;height: 131px;position: absolute;z-index: 999;width: 222px;backgrou ...
- 关于delphi XE7中的动态数组和并行编程(第一部分)
本文引自:http://www.danieleteti.it/category/embarcadero/delphi-xe7-embarcadero/ 并行编程库是delphi XE7中引进的最受期待 ...