开发者社区> 问答> 正文

多个httpd服务,怎么在系统启动时调用指定的httpd或者删除没用到的那个

WEB目录位置 : /mnt/www

问题描述 : 您好我购买的 阿里云linux一键安装web环境<专业版> 安装环境,但是重启之后 路径会变成 /var/www/html/
而不是我设置的 /mnt/www ,因为我这里有两个apache,会默认启动第一个,我想用第二个虚拟路径怎么办?

怎么使用/alidata/server/ 下面的httpd替换 etc下面的
重启完 和service httpd start启用的不是同一个apache 必须终止前面启动的那个80端口和程序 才能启用第二个apache

find / -name httpd

/run/httpd
/usr/include/httpd
/usr/sbin/httpd
/usr/libexec/initscripts/legacy-actions/httpd
/usr/lib64/httpd
/usr/share/httpd
/etc/sysconfig/httpd
/etc/logrotate.d/httpd
/etc/rc.d/init.d/httpd
/etc/httpd
/alidata/server/httpd-2.4.10/bin/httpd
/alidata/server/httpd
/alidata/log/httpd
/var/cache/httpd
/var/log/httpd

可以看到我电脑里有这么多httpd的文件或目录

我在系统重启时后的虚拟路径会变为 /var/www/html/ ,只有用这个命令 fuser -k -n tcp 80 之后再用service httpd start启来的才是/alidata/server/httpd里面的apache(虚拟路径是 /mnt/www )

而我常用的apache装在这里 /alidata/server/httpd 这是2.4的链接,虚拟路径是是 /mnt/www

我想保持系统里有唯一一个/alidata/server/httpd,并且每次重启后虚拟路径都是/mnt/www

cod*@gmail.com : /etc/rc.d/rc.local
ptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERAD#!/bin/bash

THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES

It is highly advisable to create own systemd services or udev rules

to run scripts during boot instead of using this file.

In constrast to previous versions due to parallel execution during boot

this script will NOT be run after all other services.

Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure

that this script will be executed during boot.

touch /var/lock/subsys/local
/etc/init.d/mysqld start
service httpd start

/usr/sbin/apachectl start

systemctl start vsftpd.service
/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/db/ --port=27017 --fork --logpath=/usr/local/mongodb/mongodb.log
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERAD
mknod /dev/ppp c 108 0
echo 1 > /proc/sys/net/ipv4/ip_forward

init.d

!/bin/sh

Licensed to the Apache Software Foundation (ASF) under one or more

contributor license agreements. See the NOTICE file distributed with

this work for additional information regarding copyright ownership.

The ASF licenses this file to You under the Apache License, Version 2.0

(the "License"); you may not use this file except in compliance with

the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

Apache control script designed to allow an easy command line interface

to controlling Apache. Written by Marc Slemko, 1997/08/23

The exit codes returned are:

XXX this doc is no longer correct now that the interesting

XXX functions are handled by httpd

0 - operation completed successfully

1 -

2 - usage error

3 - httpd could not be started

4 - httpd could not be stopped

5 - httpd could not be started during a restart

6 - httpd could not be restarted during a restart

7 - httpd could not be restarted during a graceful restart

8 - configuration syntax error

When multiple arguments are given, only the error from the last

one is reported. Run "apachectl help" for usage info

ACMD="$1"
ARGV="$@"

|||||||||||||||||||| START CONFIGURATION SECTION ||||||||||||||||||||

-------------------- --------------------

the path to your httpd binary, including options if necessary

HTTPD='/alidata/server/httpd/bin/httpd'

pick up any necessary environment variables

if test -f /alidata/server/httpd/bin/envvars; then
. /alidata/server/httpd/bin/envvars
fi

a command that outputs a formatted text version of the HTML at the

url given on the command line. Designed for lynx, however other

programs may work.

LYNX="lynx -dump"

the URL to your server's mod_status status page. If you do not

have one, then status and fullstatus will not work.

STATUSURL="http://localhost:80/server-status"

Set this variable to a command that increases the maximum

number of file descriptors allowed per child process. This is

critical for configurations that use many file descriptors,

such as mass vhosting, or a multithreaded server.

ULIMIT_MAX_FILES="ulimit -S -n ulimit -H -n"

-------------------- --------------------

|||||||||||||||||||| END CONFIGURATION SECTION ||||||||||||||||||||

Set the maximum number of file descriptors allowed per child process.

if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then

$ULIMIT_MAX_FILES

fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then

ARGV="-h"

fi

case $ACMD in
start|stop|restart|graceful|graceful-stop)

$HTTPD -k $ARGV
ERROR=$?
;;

startssl|sslstart|start-SSL)

echo The startssl option is no longer supported.
echo Please edit httpd.conf to include the SSL configuration settings
echo and then use "apachectl start".
ERROR=2
;;

configtest)

$HTTPD -t
ERROR=$?
;;

status)

$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
;;

fullstatus)

$LYNX $STATUSURL
;;

*)

$HTTPD "$@"
ERROR=$?

esac

exit $ERROR
2016-09-14 14:13:45

所有的站点配置在 /alidata/server/httpd-2.4.10/conf/vhosts
并且是正常有效的,但是系统重启多后访问的配置文件 不是这个了
怎么让系统启动后直接访问这个apache里面的虚拟路径
不用每次 系统启动后非要fuser -k -n tcp 80 之后 再service httpd start

展开
收起
meiyiren 2016-09-14 18:06:20 5337 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载