开发者社区> 问答> 正文

ubuntu下nginx源码安装问题 403.10 禁止访问:配置无效

进行安装,最后执行 /etc/init.d/nginx start 时报错:“
/etc/init.d/nginx: 第 17 行: [: =: 期待一元表达式
Starting nginx:

/etc/init.d/nginx 中的内容为:

start

!/bin/bash

nginx Startup script for the Nginx HTTP Server

it is v.0.0.2 version.

chkconfig: - 85 15

description: Nginx is a high-performance web and proxy server.

It has a lot of features, but it's not for everyone.

processname: nginx

pidfile: /var/run/nginx.pid

config: /usr/local/nginx/conf/nginx.conf

nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"

Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0

Start nginx daemons functions.

start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
$nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ]
return $RETVAL
}

Stop nginx daemons functions.

stop() {
echo -n $"Stopping $prog: "
$nginxd -s stop
RETVAL=$?
echo
[ $RETVAL = 0 ]
}

reload nginx service functions.

reload() {
echo -n $"Reloading $prog: "

  #kill -HUP `cat ${nginx_pid}` 
  killproc $nginxd -HUP 
  RETVAL=$? 
  echo 

}

See how we were called.

case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop}"
exit 1
esac
exit $RETVAL

end

访问 localhost 时却能打开nginx默认主页,
想问下,我这个nginx算安装好了吗》?按我这个步骤安装好的nginx怎样修改其他配置(如:默认端口等)
详情各位拍砖指点。。。

展开
收起
kun坤 2020-05-27 21:29:20 741 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载