阿里云镜像站: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
<VirtualHost *:80>
ServerAdmin root@localhost
ServerName localhost:80
DocumentRoot “/var/www/html”
<Directory “/var/www/html”>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
<VirtualHost *:8080>
ServerAdmin root@localhost
ServerName localhost:8080
DocumentRoot “/var/www/html1”
<Directory “/var/www/html1”>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted