安装httpd服务
1.)检查
rpm -e httpd --nodeps
2.)Apache配置及运行需要apr,pcre等软件包支持
rpm -ivh apr-1.4.8-3.el7_4.1.x86_64.rpm
rpm -ivh apr-devel-1.4.8-3.el7_4.1.x86_64.rpm
rpm -ivh cyrus-sasl-devel-2.1.26-23.el7.x86_64.rpm
rpm -ivh expat-devel-2.1.0-10.el7_3.x86_64.rpm
rpm -ivh libdb-devel-5.3.21-24.el7.x86_64.rpm
rpm -ivh openldap-devel-2.4.44-13.el7.x86_64.rpm
rpm -ivh apr-util-1.5.2-6.el7.x86_64.rpm
rpm -ivh apr-util-devel-1.5.2-6.el7.x86_64.rpm
rpm -ivh pcre-devel-8.32-17.el7.x86_64.rpm
rpm -ivh pcre-8.32-17.el7.x86_64.rpm
3.)将httpd源码包解压到/usr/src目录下
tar zxf httpd-2.4.25.tar.gz -C /usr/src
cd /usr/src/httpd-2.4.25/
4.)配置
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi --disable-proxy
make && make install
5.)确认安装结果
ls /usr/local/httpd
ln -s /usr/local/httpd/bin/* /usr/local/bin
ls -l /usr/local/bin/httpd /usr/local/bin/apachectl
6.)添加httpd系统服务
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
添加一行#chkconfig: 35 85 21
chkconfig --add httpd
7.)启动httpd及查看服务状态
systemctl enable httpd.service
systemctl is-enabled httpd.service
httpd服务器的基本配置(web站点部署)
1.)配置httpd服务
vim /usr/local/httpd/conf/httpd.conf
ServerName www.bdqn.com //设置网站名称
检查语法
apachectl -t
2.)启动httpd服务
systemctl start httpd
netstat -anpt | grep httpd
3.)部署网页文档
vim /usr/local/httpd/htdocs/index.html
it works!
httpd.conf配置文件
1.全局配置
ServerRoot //设置httpd服务器的根目录,httpd的安装目录
Listen 80 //监听端口默认为80
User //默认daemon,运行httpd进程时的用户身份
Group //默认daemon,运行httpd进程时的组身份
ServerAdimin //httpd服务器的管理员E-mail地址
ServerName //设置web站点的完整主机名+域名
DocumentRoot //设置网站根目录,网页文档存放路径
Directoryindex //设置网站的默认搜索页
ErrorLog // 错误日志路径
LogLevel //记录日志级别
Customlog //访问日志文件的路径,日志类型,默认路径为logs/access_log
PidFile //用于保存httpd进程号的文件,默认保存地址logs/httpd.pid
AddDefaultCharset //设置网页默认使用的字符编码,如utf-8 , gb2312
Include //可以实现特殊功能的配置放到一个单独的文件中,不会影响主配置文件
2.区域配置
//定义"/“目录区域的开始
Options FollowSymLinks //控制选项,允许使用符号链接
AllowOverride none //不允许隐含控制文件中的覆盖配置
Require all denied //禁止任何人访问此区域
//定义”/"目录区域的结果
安装httpd服务
猜你喜欢
转载自blog.csdn.net/weixin_44360341/article/details/85566218
今日推荐
周排行