【问题标题】:Installing rails + passenger + nginx in digitalocean在 digitalocean 中安装 rails + Passenger + nginx
【发布时间】:2015-04-26 17:14:14
【问题描述】:

当我尝试在我的 droplet 上运行 nginx 时..我得到了 /etc/init.d/nginx 的错误:语法错误:新行意外..我已经搜索了所有内容,但没有得到答案。

猫 /etc/init.d/nginx :

<html>
<head>
<title>Welcome to nginx!</title>
</head>
<body bgcolor="white" text="black">
<center><h1>Welcome to nginx!</h1></center>
</body>
</html>

有人对此有想法吗?

【问题讨论】:

  • /etc/init.d/nginx 应该是一个启动 nginx 的脚本。这是错误的,因为它是 html。您的问题中的那个或某些内容(文件的内容或文件本身)都离题了。
  • 先生,我该怎么办?你知道如何解决这个问题吗?
  • 我很想回到您所遵循的任何教程的开头并再次非常仔细地执行这些步骤。我什至无法预测您是如何在脚本文件中使用 html 的。
  • 正如@Shadwell 提到的,这里似乎出了点问题!如果您链接到您所关注的内容,我们可能会更好地了解这是如何发生的。您可能想尝试一下本教程:How To Deploy a Rails App with Passenger and Nginx on Ubuntu 14.04
  • 谢谢@andrewsomething 先生 .. 我将尝试重新安装所有内容并点击您分享的链接。

标签: ruby-on-rails nginx passenger digital-ocean


【解决方案1】:

除了上面的好 cmets,我要补充一点,应该不需要编辑 /etc/init.d/nginx

如果您想重置文件,以下是脚本的默认版本。

#!/bin/sh
### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $network $remote_fs $local_fs
# Required-Stop:     $network $remote_fs $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Stop/start nginx
### END INIT INFO

# Author: Sergey Budnevitch <sb@nginx.com>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=nginx
NAME=nginx
CONFFILE=/etc/nginx/nginx.conf
DAEMON=/usr/sbin/nginx
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
SLEEPSEC=1
UPGRADEWAITLOOPS=5

[ -x $DAEMON ] || exit 0

[ -r /etc/default/$NAME ] && . /etc/default/$NAME

DAEMON_ARGS="-c $CONFFILE $DAEMON_ARGS"

. /lib/init/vars.sh

. /lib/lsb/init-functions

do_start()
{
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
        $DAEMON_ARGS
    RETVAL="$?"
    return "$RETVAL"
}

do_stop()
{
    # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --oknodo --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    rm -f $PIDFILE
    return "$RETVAL"
}

do_reload() {
    #

确保脚本是可执行的 - chmod +x,如果需要的话。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-29
    • 2020-02-03
    • 1970-01-01
    • 2011-11-28
    • 1970-01-01
    • 2015-02-18
    相关资源
    最近更新 更多