2020-07-15 21:55:28
本文介绍在centos 7 yum安装apache 2.4,即通过yum仓库来快速安装已经编译好的版本,这样比源码编译省下不少时间。
1.安装apache 2.4
sudo yum install httpd
2.更新httpd.conf中的网站根目录配置。添加
文件片断:/etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/example.com/public_html"
...
<IfModule prefork.c>
StartServers 5
MinSpareServers 20
MaxSpareServers 40
MaxRequestWorkers 256
MaxConnectionsPerChild 5500
</IfModule>
1.在conf.d目录创建vhost.conf来存储你的虚拟主机配置文件。下面是example.com网站的模板;根据你的需要来更改:
文件片断:/etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/html/example.com/public_html/
ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>
其它额外的域名也同样添加到vhost.conf文件。要添加域名,复制上面的VirtualHost区块并更改。当收到来自互联网的一个新的请求,apache将在vhost.conf来检查域名匹配的VirtualHost区块:
2.创建与上面相关的目录
sudo mkdir -p /var/www/html/example.com/{public_html,logs}
3.设置apache开机启动并重启服务:
sudo systemctl enable httpd.service
sudo systemctl restart httpd.service
现在可以访问你的域名来测试apache server了。如果在你的网站根目录没有找到index文件,将显示默认的页面
CentOS 7内置的防火墙默认设置阻止web流量。执行如下命令来允许web流量:
sudo firewall-cmd --add-service=http --permanent && sudo firewall-cmd --add-service=http --permanent
sudo systemctl restart firewalld
centos7安装配置gitlab(使用外部nginx)
06-11
centos7安装配置squid正向代理
06-23
配置apache运行cgi程序
05-09
centos7.3下配置LAMP部署WordPress博客
07-04
centos 6.9安装配置本地yum服务器
02-21
centos 6.x/7.x yum安装配置Nginx
03-01
centos7.1 LVS健康检查bash脚本
06-26
centos-5 yum安装mysql-5.5/5.1
05-29
centos-5 yum安装nginx php53 mysql55 lnmp环境
04-18
centos-5 rpm安装yum
04-28
rpmbuild在centos 5与centos 6用法的异同
05-31
centos 7配置并更换为本地或网络yum源
07-17
centos7安装配置PostgreSQL数据库服务器
06-20
Debian 7 (Wheezy)安装配置apache mod_fastcgi PHP-FPM
07-20
Docker安装配置tomcat jdk
06-21
TR260 G2服务器内存DIMM安装配置和内存插的槽分布
06-23
centos 7 JDK、Tomcat9 安装并配置
05-29
yum install出现thread.error: can’t start new thread的解决方法
02-12
python升级后使用yum出现No module named yum错误处理
02-12
配置haproxy在http请求头添加后端用户真实IP
07-05
centos(linux操作系统) 6.4 最新版
3.85GB
下载HofoSetup(安装程序制作软件)v8.5.4 破解版
5.7M
下载editplus3中文版 (附安装教程) v3.41
1.41M
下载h3c模拟器(网络虚拟环境配置工具) 1.5.2 正式版
59.1M
下载usb3.0驱动(硬件驱动安装工具) v6.6 绿色版
8.67MB
下载矮人DOS工具箱 V5.3 Bulid 6.713 安装版
9.01M
下载硬盘安装器(系统安装工具) 1.6.10.6 中文版
17.35 MB
下载系统之家一键重装系统(系统自动安装工具)12.5.48.1830 最新版
28.4M
下载驱动总裁最新绿色免安装版 2.6.0.0 最新版
287.73M
下载360安全桌面下载
42.53M
下载3d蓝光播放器下载
36.8 MB
下载apache Logs Viewer(apache日志分析工具) v5.0.0.42
22.98 MB
下载Virtual CloneDrive下载
1.6MB
下载autocad2014破解版下载
1505.28MB
下载pkpm2010破解版下载
1.56GB
下载xlive下载
21.3MB
下载和平网络电视下载
4.2M
下载黄山IE修复专家下载
4.44MB
下载