1. 查看web服务器版本
Apache:
httpd -v 或者 apachectl -v
安装目录:
/etc/httpd/
寻找安装目录:
TBD
编辑apache配置文件: //目录未定,要视情况而定
vim /etc/httpd/httpd.conf
2. 启动/停止/重启apache服务, 已经开机启动
前提:apache安装成为linux的服务[什么时候不是服务 ?TBD]
方式一:
使用 systemctl start/restart/stop httpd.service ,如下
systemctl enable httpd.service //开机启动
systemctl status httpd.service //查看运行状态
以上本质是在执行:
/bin/systemctl start httpd.service
/bin/systemctl restart httpd.service
/bin/systemctl stop httpd.service
/bin/systemctl status httpd.service //查看运行状态信息
备注:
Linux 服务管理两种方式service和systemctl
systemctl不只是对apache, 如redis或者firewall等服务都是进行管理的。
如关闭/打开/查看防火墙[状态]:
备注:
如果开启了防火墙和selinux,web服务器是不能对外提供服务的,即被阻隔了服务。
现在关闭防火墙和selinux
博客:http://ningxiaofa.top/
正常访问
详情见: LAMP - 学习/实践_穿素白衫的中少年的博客-CSDN博客
方式二:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务
备注:
具体如何使用httpd -h命令, 另行查找资料
Linux httpd命令是Apache HTTP服务器程序。
httpd为Apache HTTP服务器程序。直接执行程序可启动服务器的服务。
2. Nginx:
TBD
3. 查看php版本
php -v 或者 php --version
4. 查看mysql版本
mysql -v 或者 mysql --version
或者进入mysql, 执行sql: select version();
5. [进入]apache web根目录
cd /usr/local/apache/htdocs
方式一:
启动apache服务
# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
//重启apache服务
# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
//停止apache服务
# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop
...