[1] 安装 httpd.
[root@linuxprobe ~]# yum -y install httpd
# 删除默认欢迎页面
[root@linuxprobe ~]# rm -f /etc/httpd/conf.d/welcome.conf
[2] 配置httpd,将服务器名称替换为您自己的环境
[root@linuxprobe ~]# vi /etc/httpd/conf/httpd.conf
# line 86: 改变管理员的邮箱地址(在 vim 里查看行数 :
set
number
)
ServerAdmin root@linuxprobe.org
# line 95: 改变域名信息
ServerName www.linuxprobe.org:80
# line 151: none变成All
AllowOverride All
# line 164: 添加只能使用目录名称访问的文件名
DirectoryIndex index.html index.cgi index.php
# add follows to the end
# server‘s response header(安全性)
ServerTokens Prod
# keepalive is ON KeepAlive On
[root@linuxprobe ~]# systemctl start httpd
[root@linuxprobe ~]# systemctl enable httpd
[3] 如果Firewalld正在运行,请允许HTTP服务。,HTTP使用80 / TCP
[root@linuxprobe ~]# firewall-cmd --add-service=http --permanent
提示FirewallD is not running:https://jingyan.baidu.com/article/5552ef47f509bd518ffbc933.html
1.通过systemctl status firewalld查看firewalld状态,发现当前是dead状态,即防火墙未开启。
2.通过systemctl start firewalld开启防火墙,没有任何提示即开启成功。
3.再次通过systemctl status firewalld查看firewalld状态,显示running即已开启了。
4.如果要关闭防火墙设置,可能通过systemctl stop firewalld这条指令来关闭该功能。
success #成功
[root@linuxprobe ~]# firewall-cmd --reload
success #成功
apache
启动
systemctl start httpd
停止
systemctl stop httpd
重启
systemctl restart httpd
mysql
启动
systemctl start mysqld
停止
systemctl stop mysqld
重启
systemctl restart mysqld
php-fpm
启动
systemctl start php-fpm
停止
systemctl stop php-fpm
重启
systemctl restart php-fpm
nginx
启动
systemctl start nginx
停止
systemctl stop nginx
重启
systemctl restart nginx