linux安装两个apache

先正常的安装一个apache到   /usr/local/httpd

 

复制一份到/usr/local/httpd2

 

修改http2/conf/httpd.conf中所有目录中含有httpd路径修改为httpd2,修改对应的端口,文件路径等等

 

修改/usr/ local /httpd2/bin/apachectl含有httpd路径修改为httpd2

 

修改/usr/ local / httpd2/bin/envvars含有httpd路径修改为httpd2

 

修改/usr/ local / httpd2/bin/envvars含有httpd路径修改为httpd2

 

修改/usr/ local /apache1/bin/envvars-std含有httpd路径修改为httpd2

 

创建/usr/ local /http2/bin/apache.sysvinit

脚本内容如下:注意里面要根据你的路径修改对应路径

#!/bin/sh

#

# Thisis a sample /etc/init.d file for apache

#

#chkconfig: 2345 80 30

# description:apache1 - WWW server

#

#

#

 

prefix=/usr/ local /httpd2

exec_prefix=/usr/ local /httpd2

bindir=${exec_prefix}/bin

sbindir=${exec_prefix}/sbin

 

case"$1" in

start)

    echo -n "Starting httpd2 WWWserver:"

    /usr/local/httpd2/bin/apachectl -f /usr/local/httpd2/conf/httpd.conf-k start

    echo -n ""

    ;;

stop)

echo -n"Stopping httpd-zaf WWW server:"

    /usr/local/httpd2/bin/apachectl -f/usr/local/httpd2/conf/httpd.conf -k stop

    echo -n ""

    ;;

restart)

    $0 stop

    $0 start

;;

esac

exit 0

 

 

将文件复制到cp  /usr/local/http2/bin/apache.sysvinit   /etc/rc.d/init.d/httpd2

更改权限chmod  755  /etc/rc.d/init.d/httpd2

chkconfig --add httpd2

 

开启和关闭apache必须用以下语句

/etc/init.d/httpd2 start

/etc/init.d/httpd2 stop

你可能感兴趣的:(服务器)