1、先lsb_release -a 查看系统版本,不同版本情况很大区别
[root@iZ23p5a9q9nZ ~]# lsb_release -a
LSB Version::core-4.1-amd64:core-4.1-noarch
Distributor ID:CentOS
Description:CentOS Linux release 7.0.1406 (Core)
Release:7.0.1406
Codename:Core
2、先卸载apache 1,service httpd stop停止Apache 2、yum list|grep httpd #查看apache包名,例如httpd.x86_64
yum erase httpd.x86_64 #相关依赖包自动会被删除
3、安装 httpd : yum -y install httpd
安装openssl :yum install openssl
默认安装的路径为/etc/httpd/
4、然后重启 service httpd restart
5、报这个Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
错误的时候运行加载mod_ssl yum install mod_ssl
cd /etc/httpd/conf
编辑/etc/httpd/conf/httpd.conf
找到如下内容:
#ServerName www.example.com:80
更改为
ServerName localhost:80
把证书拷贝到某个目录下
cd /etc/httpd/conf/vhosts.conf
6、添加文件vhosts.conf
vim /etc/httpd/conf.d/vhosts.conf
配置apache
service httpd start
此命令查看启动Apache是报的详细错误,会提示到哪一行问题 systemctl status httpd.service -l
其他查看apache各种状态命令
service apache2 restart
service apache2 status
service apache2 reload