apache服务器安装到linux

ifconfig -a

yum clean all 
yum -y update 
yum -y install httpd

systemctl enable httpd.service	--是能够
systemctl start httpd.service	--开始

mkdir -p /var/www/edu.cloud.tencent.com/public_html	--p多级目录
chown -R apache:apache /var/ww/edu.cloud.tencent.com/public_html -- change owner
chmod -R 755 /var/ww/

vim index.html
<html>
<head>
<title>Juna3066</title>
</head>

<body>
<h1>I love three things in the world</h1>
</body>
</html>

mkdir /etc/httpd/sites-available
mkdir /etc/httpd/sites-enabled

vim /etc/httpd/conf/httpd.conf
修改配置文件
尾加
IncludeOptional sites-enabled/*.conf


vim /etc/httpd/sites-available/edu.cloud.tencent.com.conf
<VirtualHost *:80>
ServerName edu.cloud.tencent.com
DocumentRoot /var/www/edu.cloud.tencent.com/public_html
ErrorLog /var/www/edu.cloud.tencent.com/error.log
CustomLog /var/www/edu.cloud.tencent.com/requests.log combined
</VirtualHost>


ln -s /etc/httpd/sites-available/edu.cloud.tencent.com.conf /etc/httpd/sites-enabled/edu.cloud.tencent.com.conf

cat查看软连接是否正常
apachectl restart

 

 

  

原文地址:https://www.cnblogs.com/juna3066/p/14100619.html