一、Linux系统服务管理的状态查看、开启、关闭命令
查看**服务的当前状态 |
service **服务 status |
开启**服务 |
service **服务 start |
关闭**服务 |
service **服务 stop |
查看所有服务当前的状态 | service --status-all |
查看指定**服务当前的状态 | service --status-all | grep **服务(如:httpd) |
查看所有的服务开机状态 |
chkconfig --list |
查看指定的**服务开机自启状态 |
chkconfig --list iptables (iptables:防火墙) |
关闭**服务开机自启状态(默认系统级别2、3、4、5) |
chkconfig **服务 off |
打开**服务(如:防火墙)开机自启状态 |
chkconfig iptables on |
关闭指定某些系统级别的开机自启动状态 | chkconfig --level 24 iptables off (只修改2、4) |
开启指定某些系统级别的开机自启动状态 | chkconfig --level 24 iptables on (只修改2、4) |
系统级别解释:https://mp.csdn.net/postedit/102494276
二、httpd服务
apache的web服务器,默认端口为80
2.1 httpd状态查看、启动与关闭
service httpd status ##查看状态(一般是关闭的:httpd is stopped)
service httpd start ##启动httpd
service httpd stop ##关闭httpd
service --status-all ##查看所有服务的状态
service --status-all | grep httpd ##查看指定服务的状态
chkconfig --list httpd ##查看httpd服务的开机自启动状态
chkconfig httpd on ##打开httpd开机自启状态
2.2 尝试用windows访问
查看linux系统ip(命令:ifconfig),如:192.168.2.101
在windows系统浏览器输入http://192.168.2.101
如果不能访问,检查linux防火墙是否关闭(命令:service iptables status)
检查发现防火墙开启,则需要关闭(临时关闭:service iptables stop ,开机自启关闭:chkconfig iptables off)
再次在windows中访问http://192.168.2.101,访问成功。
2.3 放置资源并访问
httpd的资源目录:/var/www/html/ 用http://192.168.2.101访问可以查看到,
进入该目录下命令:cd /var/www/html 查看一下里面有些什么内容命令:ll,
如果没有内容,添加一些,如:vim test1.txt 并写入 I love linux ,mkdir test2,
touch test3.mp3 ...,然后将文件迁移到test2目录下,mv -f test1.txt test2 , mv -f test3.mp3 test2,
访问资源:在windows的浏览器中打开:http://192.168.2.101/test2,http://192.168.2.101/test2/test1.txt
linux有关资源/工具/安装包下载在浏览器中输入地址:archive.apache.org/dist