Linux学习笔记——Apache的安装与配置

阿里云镜像站:https://developer.aliyun.com/mirror/

查看yum源:ls /etc/yum.repos.d/

安装阿里云的epel镜像:

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

查看是否已安装阿帕奇:rpm -qa | grep httpd

安装阿帕奇yum install -y httpd httpd-*

删除文件中的#号:sed -i '/#/d' httpd.conf

删除文件中的空格:sed -i '/^$/d' httpd.conf

创建多个网站:(在/etc/httpd/conf.d/目录下创建后缀为.conf的文件)

在/etc/httpd/conf/httpd.conf中添加

Listen 80
Listen 8080


ServerAdmin root@localhost
ServerName localhost:80
DocumentRoot “/var/www/html”

Options Indexes FollowSymLinks
AllowOverride All
Require all granted



ServerAdmin root@localhost
ServerName localhost:8080
DocumentRoot “/var/www/html1”

Options Indexes FollowSymLinks
AllowOverride All
Require all granted

你可能感兴趣的:(linux,学习技术,linux,centos,apache)