1
回答
为什么Apache编译时指定了目录apache不遵守啊?
【腾讯云】校园拼团福利,1核2G服务器10元/月!>>>   

apache 载入 conf 文件一定是 apache/conf/httpd.conf 么

为什么非要是apache开头》?》

我的编译代码如下

cd $BASE_DIR
    #remove previous installation
    rm -r apache*
    #install dependencies

    #make directory
    [[ -d apache-${apache_version} ]] || mkdir apache-${apache_version}
    [[ -d www ]] || mkdir www
    #prepare files
    if [ -f www/index.php];then
        echo "!www files existed, ignore."
    else
        touch www/index.php
        echo "<?php echo phpinfo(); ?>" >> www/index.php
    fi
    extract_source "httpd-${apache_version}" "${BASE_DIR}/install/temp/"
    cd $BASE_DIR
    #install
    cd install/temp/httpd-${apache_version}
    ./configure\
        --prefix=$BASE_DIR/apache-${apache_version}\
        --enable-so
        #--bindir=/usr/bin\
        #--sbindir=/usr/sbin\
        #--libdir=/usr/lib/httpd/lib\
        #--libexecdir=/usr/lib/httpd/modules\
        #--installbuilddir=/usr/lib/httpd/build\
        #--htmldir=$BASE_DIR/www\
    make
    make install

    #configuration
    groupadd httpd #create group and user if not exitsts
    useradd -s /bin/false -g httpd httpd
    mv apache-${apache_version}/htdocs/index.html www/index.html
    cp apache-${apache_version}/conf/httpd.conf apache-${apache_version}/conf/httpd.conf.bak #backup original conf file
    sed -i -e "s/User daemon/User httpd/" -e "s/Group daemon/Group httpd/" -e "s/apache-${apache_version}\/htdocs/www/" apache-${apache_version}/conf/httpd.conf


    #cleanup
    cp apache-${apache_version}/bin/httpd apache-${apache_version}/bin/httpd.bak
    strip /usr/bin/httpd


报错如下

httpd: Could not open configuration file /home/latel/Desktop/cniil/apache/conf/httpd.conf: No such file or directory



然后启动非要是从apache目录里找。我编译时指定的目录是apache-版本号了啊。。。。 请帮帮小妹吧
举报
Solowave
发帖于4年前 1回/147阅
共有1个答案 最后回答: 4年前
直接用--prefix指定安装目录就好了,所有东西就放到这个目录下了. 
另外2.2系列自带了apr和pcre库,2.4则需要自己下载了并放到srclib下.

./configure \
--prefix=/opt/httpd \
--enable-mods-shared=most \
--enable-ssl=shared \
--with-ssl=/usr \
--with-included-apr \
--with-mpm=prefork

make && make install

服务管理: 
sudo /opt/httpd/bin/apachectl {start|stop|restart}
顶部