美文网首页
CentOS 7 + Apache 配置虚拟机主机

CentOS 7 + Apache 配置虚拟机主机

作者: 路小飞 | 来源:发表于2017-12-11 15:14 被阅读21次

1.安装配置apache

yum install httpd #安装httpd

systemctl enable httpd  #设置开机启动

wget http://dl.fedoraproject.org/pub/epel/7/x86_64/m/mod_xsendfile-0.12-10.el7.x86_64.rpm  #下载xsendfile扩展

rpm -ivh mod_xsendfile-0.12-10.el7.x86_64.rpm  #安装扩展

注意:如果安装的时候,提示与httpd版本不匹配,依赖不足,可以到http://mirrors.opencas.cn/epel查找合适的安装源

2.创建配置文件:

sudo vi /etc/httpd/conf.d/demo.conf

添加如下配置,更改自己的域名

<VirtualHost *:80>

        ServerName www.XXX.com  #域名

        ServerAlias www.XXX.com #别名

        DocumentRoot /var/www/edusoho/web

        # enable the .htaccess rewrites

        AllowOverride All

        Order allow,deny

        Allow from All

        ErrorLog /var/log/edusoho_error.log

        CustomLog /var/log/edusoho_access.log combined

</VirtualHost>

重启Apache:

systemctl restart apache

相关文章

网友评论

      本文标题:CentOS 7 + Apache 配置虚拟机主机

      本文链接:https://www.haomeiwen.com/subject/qnviixtx.html