玩linux的主机,玩玩Linux云主机-Ubuntu安装apache2

Make sure you have APR and APR-Util already installed(安装) on your system. If you don’t, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into /httpd_source_tree_root/srclib/apr and /httpd_source_tree_root/srclib/apr-util (be sure the directory names do not have version numbers; for example, the APR distribution(分布) must be under /httpd_source_tree_root/srclib/apr/) and use ./configure’s –with-included-apr option. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.

wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz

wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz

上面说的很清楚 放置在apr-util 目录下和apr

0818b9ca8b590ca3270a3433284dd417.png

下载完了,然后解压移动到目录

0818b9ca8b590ca3270a3433284dd417.png

5. ./configure –prefix=/usr/local/apache2 再来试试,发现成功了诶

紧接着 make install …

6. 启动试试 /usr/local/apache2/bin/apachectl start

0818b9ca8b590ca3270a3433284dd417.png

7. 在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现:

/usr/local/apache2/bin/apachectl start | stop | restart

如果想将httpd列入系统自动启动的服务,可以直接将上述的apachectl文件拷贝到 /etc/init.d/中 ,就像mysql 一样

http://blog.sina.com.cn/s/blog_6739945f0100zgpb.html

http://www.voidcn.com/article/p-ymultsej-od.html

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

chkconfig -add httpd

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

这些是系统启动的级别

我们就可以通过service命令来启动关闭apache了。在任意路径下执行:service httpd start | stop | restart

0818b9ca8b590ca3270a3433284dd417.png

chkconfig在命令行操作时会经常用到,它可以方便地设置和查询不同运行级上的系统服务chkconfig 语法:

chkconfig [–add] [–del] [–list] [系统服务]

chkconfig [–level/levels] [等级代号] [系统服务] [on/off/reset]

等级代码为:linux系统的运行级别。linux 将操作 环境分为以下7个等级,即

0:关机

1:单用户模式(单用户、无网络)

2:无网络支持的多用户模式(多用户、无网络)

3:有网络支持的多用户模式(多用户、有网络)

4:保留,未使用

5:有网络支持有X-Window支持的多用户模式(多用户、有网络、X-Window界面)

6:重新引导系统,即重启

先用chkconfig list查询apache和mysql服务是否存在,不存在则需要手动添加。

添加apache服务项命令:

chkconfig -add httpd

添加完设置启动项:

chkconfig –level 2345 httpd on

chkconfig –level 2345 mysqld on

http://www.cnblogs.com/Anker/p/3551508.html

8. 看看apache的目录和windows的差不多啊

0818b9ca8b590ca3270a3433284dd417.png

9. 支持Php

http://jingyan.baidu.com/article/d2b1d10299bda55c7f37d466.html

http://www.bkjia.com/Linuxjc/1096474.html

http://www.cnblogs.com/roronoa-sqd/p/5469687.html

之前我在使用安装php7的时候没有指定参数,所以在modules下面没有产生支持php的可执行文件,所以重新安装一次。

./configure

–prefix=/usr/local/php/

–with-apxs2=/usr/local/apache2/bin/apxs

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值