有关在linux下安装apache的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了有关在linux下安装apache的问题相关的知识,希望对你有一定的参考价值。

[root@p2pserver httpd-2.2.4]# /etc/init.d/httpd restart
-bash: /etc/init.d/httpd: No such file or directory
[root@p2pserver httpd-2.2.4]# /usr/local/apache/bin/httpd restart
Usage: /usr/local/apache/bin/httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed settings (currently only vhost settings)
-S : a synonym for -t -D DUMP_VHOSTS
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files

参考技术A 你自己编译的 apache ?
用个rpm的 方便些

启动的话 直接 service httpd start

/usr/local/apache/bin/httpd 命令启动 参数你网上找下本回答被提问者采纳
参考技术B 1.编译安装的看报错提示需要如下命令
/usr/local/apache/bin/httpd -k restart

2.yum安装的如下
yum -y install httpd httpd-devel
chkconfig --level 35 httpd on
/etc/init.d/httpd start
参考技术C rpm包安装:
service httpd restart

源码安装:
安装路径/apachectl restart

linux下手动安装apache详解

操作系统:ubuntu12.04

前言:
    linux下,默认安装软件,在开发过程中会经常不知道到什么路径下找到所需的程序,因此手动安装程序对后续的使用会提供非常大的便利。在此,以安装apache为例。

 


一,准备
    1,安装 apr
        下载地址:http://apr.apache.org/download.cgi

            [[email protected]:/work/soft/apache]# tar jxvf apr-1.5.0.tar.bz2

            [[email protected]@ubuntu:/work/soft/apache/apr-1.5.0]# ./configure --prefix=/work/installed/apr

            [[email protected]@ubuntu:/work/soft/apache/apr-1.5.0]# make

            [[email protected]@ubuntu:/work/soft/apache/apr-1.5.0]# make install


    2,安装 apr-util
        下载地址:http://apr.apache.org/download.cgi
            [[email protected]:/work/soft/apache]# tar jxvf  apr-util-1.5.3.tar.bz2

            [[email protected]@ubuntu:/work/soft/apache/apr-util-1.5.3]# ./configure --prefix=/work/installed/apr-util --with-apr=/work/installed/apr

            [[email protected]@ubuntu:/work/soft/apache/apr-util-1.5.3]# make

            [[email protected]@ubuntu:/work/soft/apache/apr-util-1.5.3]# make install


    3,安装 pcre
        下载地址:http://pcre.org/
            [[email protected]:/work/soft/apache]# tar jxvf  pcre-8.35.tar.bz2

            [[email protected]@ubuntu:/work/soft/apache/pcre-8.35]# ./configure --prefix=/work/installed/pcre

            [[email protected]@ubuntu:/work/soft/apache/pcre-8.35]# make

            [[email protected]@ubuntu:/work/soft/apache/pcre-8.35]# make install


        注意:如果在安装 pcre 时,遇到问题:configure: error: You need a C++ compiler for C++ support.
        解决方法sudo apt-get install build-essential


二,安装apache
        下载地址:http://httpd.apache.org/
            [[email protected]:/work/soft/apache]# tar jxvf  httpd-2.4.9.tar.bz2

            [[email protected]@ubuntu:/work/soft/apache/httpd-2.4.9]#  ./configure --prefix=/work/installed/apache --with-apr=/work/installed/apr --with-apr-util=/work/installed/apr-util --with-pcre=/work/installed/pcre

            [[email protected]@ubuntu:/work/soft/apache/httpd-2.4.9]# make

            [[email protected]@ubuntu:/work/soft/apache/httpd-2.4.9]# make install



三,配置
        1,修改配置文件
            否则会出现问题:
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName‘ directive globally to suppress this message
            解决方法:
            [[email protected]:/work/installed/apache]# sudo gedit conf/httpd.conf 
            把:
                ServerName www.example.com:80
            改为:
                ServerName localhost:80

    
        2,启动
            [[email protected]:/work/installed/apache]# ./bin/apachectl start
            技术分享

        3,开机启动
            打开文件:/etc/rc.local
            [[email protected]:/]# sudo gedit /etc/rc.local 

            添加:/work/installed/apache/bin/apachectl start
            

四,参考文件
1,http://blog.csdn.net/chenxiaohua/article/details/2047757
2,http://blog.163.com/hlz_2599/blog/static/142378474201182811611382/    

以上是关于有关在linux下安装apache的问题的主要内容,如果未能解决你的问题,请参考以下文章

Linux(Debian)下Maven的安装

mac下webpagetest搭建

转摘 Linux:Tomacat安装配置,项目部署

Centos6.5 下安装配置Apache+PHP+Mysql环境

Linux+Apache下如何安装SSL证书

Storm 快速安装及部署示例