首页 新闻 会员 周边 捐助

centos7配置tengine2.1.0出错

0
[待解决问题]

今天按照教程上说的在centos7上配置tengine出错Starting nginx (via systemctl):  Failed to issue method call: Unit nginx.service is masked.    [失败]  在网上搜也没搜到  

  具体我的配置过程如下

 

  1. 把tengine放到/opt目录下 然后解压
  2. 安装依赖yum -y install gcc openssl-devel pcre-devel zlib-devel
  3.  进入解压好的tengine文件里 然后复制下面这一段执行
./configure \
  --prefix=/opt/sxt/soft/tengine-2.1.0/ \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_stub_status_module \
  --with-http_gzip_static_module \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
  --http-scgi-temp-path=/var/tmp/nginx/scgi \
  --with-pcre
 
make && make install
 
文件把里面的内容复制粘贴到/etc/init.d/下面创建的nginx文件里 然后编辑nginx文件
nginx=后面改成/opt/sxt/soft/tengine-2.1.0/sbin/nginx

NGINX_CONF_FILE=后面改成/opt/sxt/soft/tengine-2.1.0/conf/nginx.conf

chmod 755 nginx

chkconfig nginx on 

 

最后service nginx start 出错   service nginx stop却不会出错

我自横刀微笑的主页 我自横刀微笑 | 菜鸟二级 | 园豆:202
提问于:2016-11-02 22:13
< >
分享
所有回答(2)
0

直接启动nginx如果正常,那就是service的配置问题

stytemctl enable nginx试试

2012 | 园豆:21645 (高人七级) | 2016-11-03 08:25
0

nginx脚本写得有问题,stop肯定不会出错啊,把脚本贴出来看看

silianpan | 园豆:571 (小虾三级) | 2016-11-03 11:14

 

# description: nginx is a World Wide Web server. It is used to serve
# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/opt/sxt/soft/tengine-2.1.0/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/opt/sxt/soft/tengine-2.1.0/conf/nginx.conf"

#[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

#make_dirs() {
# # make required directories
# user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
# options=`$nginx -V 2>&1 | grep 'configure arguments:'`
# for opt in $options; do
# if [ `echo $opt | grep '.*-temp-path'` ]; then
# value=`echo $opt | cut -d "=" -f 2`
# if [ ! -d "$value" ]; then
# # echo "creating" $value
# mkdir -p $value && chown -R $user $value
# fi
# fi
# done
#}

start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
# make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
configtest || return $?
stop
sleep 1
start
}

reload() {
configtest || return $?
echo -n $"Reloading $prog: "
# -HUP是nginx平滑重启参数
killproc $nginx -HUP
RETVAL=$?
echo
}

force_reload() {
restart
}

configtest() {
$nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac

支持(0) 反对(0) 我自横刀微笑 | 园豆:202 (菜鸟二级) | 2016-11-04 10:13

@我自横刀微笑: 脚本看不出问题,安装的时候有没有出错,依赖问题有没有

支持(0) 反对(0) silianpan | 园豆:571 (小虾三级) | 2016-11-26 22:55
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册