liunx查看端口-进程判断apache是否开启

1.查看端口

首先要知道apache的端口,比如说80端口;
查看端口是否被开启和监听
netstat -an | grep :80

2.查看进程

ps -ef |grep httpd
ps -aux | grep httpd
如果看到许多(一般是4到5个)输出就说明对了。

3.浏览器访问

浏览器输入IP后面冒号跟端口
如:http://192.168.0.231:808/

三个只要确定一个即可说明apache已经开启。

4.Apache服务常用的命令

查看80端口是否被占用:[ netstat -aon|findstr "80" ]

启动Apache服务:[ httpd -k start ]
停止Apache服务:[ httpd -k stop ]
重启Apache服务:[ httpd -k restart ]
查看Apache服务版本号:[ httpd -v ]
查看Apache服务的帮助:[ httpd -help ]

【可以查看到Apache的各种命令】

linux 下 apache启动、停止、重启命令

基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

推荐Apache启动方法
/usr/local/apache2/bin/apachectl start apaceh启动
/usr/local/apache2/bin/apachectl stop   停止
/usr/local/apache2/bin/apachectl restart 重启
/usr/local/sbin/apachectl graceful 重启 Apache 服务器时不中断当前的连接
如果apache安装成为linux的服务的话,可以用以下命令操作:**
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务

Linux系统为Ubuntu

Start Apache 2 Server /启动apache服务
/etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
Restart Apache 2 Server /重启apache服务
/etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
Stop Apache 2 Server /停止apache服务
 /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1.Linux下如何用命令查看实时日志(完整命令) tail -f 路径.log查看前多少行 tai-200f 路...
    qianyewhy阅读 2,330评论 0 11
  • [root@localhostapache]# cd /home/apache/解压:[root@localhos...
    狼孩与狗娃阅读 432评论 0 1
  • 1、第八章 Samba服务器2、第八章 NFS服务器3、第十章 Linux下DNS服务器配站点,域名解析概念命令:...
    哈熝少主阅读 3,779评论 0 10
  • 一、查看哪些IP连接本机 netstat -an 二、查看TCP连接数 1)统计80端口连接数netstat -n...
    夏夏夏夏顿天阅读 389评论 0 0
  • 何许?絮已无迹,南窗花相倚。纤月每羞见,迷离栏外霓。 犹记拙燕怯人意,此地曾、多重悲喜。三岁寒暑将尽也,微澜...
    阿叶禾阅读 82评论 0 2