首先下载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
# mkdir -p /usr/local/apache2 //不用切换目录,直接执行 # ./configure --prefix=/usr/local/apache2 --enable-modules=so --enable-rewrite //好多check啊~啊~~ # make //一系列的执行,耐心等着就是的 # make install //还是耐心等着
# /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】,就可以访问了~~
这个是参考网站:http://www.diaodiaox.com/