码迷,mamicode.com
首页 > Web开发 > 详细

linux编译安装apache

时间:2020-07-24 13:28:39      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:art   linux   查看   man   load   chkconfig   单词   rect   enable   

下载一个Edit with Notopad++
www.apache.org 官网下载 apr
Pcre.org 官网下载 pcre 然后去到http: //ftp.pcre.org/pub/pcre
httpd.apache.org 官网下载 apache
例子:
#ll →apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz pcre-8.40.tar.gz http-2.4.25.tar.gz
#tar zxf apr-1.5.2.tar.gz
#cd apr-1.5.2
#./configure --prefix=/usr/local/apr
#make && make install
#tar zxf apr-util-1.5.4.tar.gz
#cd apr-util-1.5.4
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make && make install →安装失败就要安装expat开发库(
#yum install expat-devel -y)
#tar zxf pcre-8.40.tar.gz
#cd pcre-8.40
#./configure --prefix=/usr/local/pcre && make && make install
#tar zxf http-2.4.25.tar.gz -C /usr/src
#cd /usr/src/http-2.4.25
#./configure --prefix=/usr/local/apache --sysconfdir=/etc --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
#make -j 4 && make install
#cd
#firewall-cmd --permanent --add-service=http
#firewall-cmd --reload
#setenforce 0
#hostname →hyj
#vim /etc/hosts
#192.168.163.106 hyj #在hosts里面新添加一横
#cat /etc/hosts
#cd
#ln -s /usr/local/apache/bin/* /usr/sbin/
#httpd -t 检查配置文件语法
#vim /etc/http.conf
#/ServerName www.example.com:80 这横是系统里面,找到这横在后面添加
ServerName www.hyj.com
#wq
#httpd -t
#httpd -k start →打开80端口
#netstat -anlpt |grep httpd
#cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
#vim /etc/init.d/httpd
#chkconfig: 345 85 15
#description: Activates/Deactivates Apache Web Server
#wq!
#chkconfig --add httpd 添加系统服务
#chkconfig --list httpd →查看开放端口号
可以用window 系统浏览器 192.168.163.106
打开windows系统→去到C盘→windows文件夹→system32文件夹→drivers→etc→用记事本编辑hosts文件(新添加一横)

现在可以通过匿名去反问了
打开windows 系统浏览器
www.hyj.com

Httpd.conf
(一般在etc下面) DocumentRoot(这个单词查看我网站主目录) “/var/www/html”
Listen (查看监听端口号)80
主机名称 域名访问站点
ServerName www.hyj.com:80
默认主页 DirectoryIndex index.html
查看服务站的根 “/etc/httpd”

linux编译安装apache

标签:art   linux   查看   man   load   chkconfig   单词   rect   enable   

原文地址:https://blog.51cto.com/14861926/2513003

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!