欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2022-03-18 09:45:30
阿里云镜像站: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' ht...

阿里云镜像站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

本文地址:https://blog.csdn.net/qq_41679358/article/details/107344133