Linux下安装apache2.2.29、部署静态html

首先下载apache安装包:http://download.csdn.net/detail/xb12369/8619361


上传到服务器目录 /usr/local/src:

1.解压缩


# cd /usr/local/src
# tar -zvxf httpd-2.2.29.tar.gz //解压
# cd httpd-2.2.29




2.创建安装目录


# mkdir -p /usr/local/apache2 //不用切换目录,直接执行
# ./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite  //好多check啊~啊~~
# make  //一系列的执行,耐心等着就是的
# make install //还是耐心等着




3.启动和关闭apache


# /usr/local/apache2/bin/apachectl -k start // 启动 apahce


//这里如果占用80端口的话,先得查看是否有80的进程

http://blog.csdn.net/xb12369/article/details/45192825

#ps -ef |grep :80



用浏览器查看 http://localhost, 得到 it works ,说明 apache 已经配置成功了 .

//如果这里提示什么servername什么的,你还的配置httpd.conf文件

--查找httpd.conf文件

#find / -name httpd.conf


--比如楼主的在/usr/local/apache2/conf

--打开此文件在99行,添加ServerName  localhost:80

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
98#ServerName www.example.com:80
99ServerName  localhost:80



# /usr/local/apache2/bin/apachectl -k stop // 停止 apache



部署静态html:

httpd.conf第30行有个路径指向:ServerRoot "/usr/local/apache2"


把你的静态html文件放在这里面【/usr/local/apache2/htdocs】,就可以访问了~~


=====================华丽的分隔符=======================


另外一种apache安装方式:

[root@localhost]yum -y install httpd


启动

[root@localhost]service httpd start


重启

[root@localhost]service httpd restart



如果希望apache跟python一样列出网站的文件目录列表,你只需要这么做:


1、将/etc/httpd/conf.d中的welcome.conf重命名成welcome.conf.bak


2、搜索节点<Directory ,在Options中添加一个Indexes


3、重启apache


最后访问:



偷笑果然研发要一份执着~






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值