Nginx 不会重新启动。 。 。 nginx.service 的作业失败,因为控制进程退出并出现错误代码

2023-11-21

我正在关注一个关于设置 Nginx 的 YouTube 视频,我正在重新启动,当我得到其中的部分时,它给出了 我需要编辑服务器块文件(sites-enabled/default)我完全按照他们在视频中所做的操作,但是当保存并尝试重新启动时:

sudo service nginx restart

我收到这个错误:Job for nginx.service failed because the control process exited with an error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

So I ran

systemctl status nginx.service

给出了输出:

Active: failed (Result: exit-code) since Fri 2018-03-02 01:36:33 EST; 10min ago

我在 Ubuntu 16.04 Linux VPS 上运行所有这些

下面是内容/etc/nginx/sites-enabled/default file:

  ##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    server_name x.x.x.x;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #


/* additions i made*/


    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        try_files $uri = 404;
        fastcgi_split_path_info ^(.*\.php)(/.*)$;
        
        # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root $fastcgi_script_name;
        include fastcgi_params;
    }

/*end of additions*/



    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

编辑:他们在视频中使用 php5.6,但我正在使用 PHP 7.0,如果这有帮助的话


出了点问题

设置错误日志记录debug通过编辑/etc/nginx/nginx.conf:
找到与error_log,验证日志文件位置并将级别更改为调试:
error_log logs/error.log debug;

尝试再次重新启动并检查日志文件以获取更多详细信息。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Nginx 不会重新启动。 。 。 nginx.service 的作业失败,因为控制进程退出并出现错误代码 的相关文章

随机推荐

  • 将函数序列应用于值序列

    我想将函数列表成对应用于值列表 下面举一个例子来说明 user gt defn a f x f x user a user gt map a inc dec 98 8 99 7 请注意 我必须定义一个函数 a 它接受一个函数并将其应用于一个
  • php 标头位置与 php_redirect

    功能有什么区别 HTTP redirect and header location 在 PHP 中 我什么时候必须使用该功能 HTTP redirect 我什么时候必须使用该功能 header location 看那个 https php
  • 访问mdb密码恢复

    我花了很多时间寻找 mdb Access 数据库结构的定义 但没有找到任何有关密码恢复的信息 我知道Access 2000 mdb文件有类似页面的东西 每个页面4kB 每个页面都有一个类型 第一页是一个 数据库定义页面 包含 可能 加密的数
  • 检测 URL 更改(无需窗口卸载)

    我想向 URL 更改之前 事件添加一个侦听器 以访问旧 URL window onbeforeunload如果页面不重新加载 AJAX 驱动的页面 则不会触发 例如 当您单击右侧导航栏中的另一个视频时 YouTube 视频页面上就会发生这种
  • 确定 iframe 中的元素在屏幕上是否可见

    我需要确定 iframe 中的元素在屏幕上是否可见 如果它位于屏幕的可见部分 我的意思是页面可能很长 用户必须滚动才能看到该元素 索引 html iframe html div div
  • gdb 在启动过程中程序退出,代码为 127

    想在 Linux Debian 中使用 gdb 作为调试器 尝试运行二进制文件我得到这个 gdb r Starting program usr local sbin test bin bash usr local sbin test No
  • 使用 CMake GUI 设置交叉编译器文件

    我正在尝试使用 CMake 设置交叉编译构建 到目前为止 我正在设置交叉编译器文件 从命令行调用 CMake 如下所示 Call cmake with the given options cmake D CMAKE TOOLCHAIN FI
  • 看似相同的字符串无法比较

    我在比较两个字符串时遇到一个奇怪的问题 这是我的代码 console log x y console log x y console log typeof x console log typeof y 在控制台中 我有 false 1 4
  • 使用 OpenSSL 生成素数

    如何使用 openssl 生成一个大的随机素数 我找到了如何生成随机数并检查它是否是素数 但我无法自动执行检查素数的过程 这是我正在使用的命令 openssl rand hex 256 xargs openssl prime hex 我应该
  • EditTextCell FieldUpdater 宽度

    编辑字段时如何设置文本框的宽度 EditTextCell febCell new EditTextCell Column
  • Sitecore Analytics:从 Web 服务触发配置文件和事件

    我有一个问题Sitecore Analytics 从我的 xslt 中 我使用 jQuery 对 Web 服务进行 ajax 调用 在我的网络服务中 我需要注册 保存一些Sitecore Analytics数据 问题是我无法使用Siteco
  • 无法在 OS X 10.11 上安装 mongo-php-driver

    我已经阅读了所有类似的 Stack Overflow 问题 没有任何内容能解决我的具体问题 我正在运行 OS X 10 11 El Capitan 我已经克隆了mongo php driver 仓库这些命令成功 phpize configu
  • MVVM 在视图模型之间传递值

    我尝试处理将值从一个 ViewModel 传递到另一个 ViewModel 的问题 这是一个例子 我们有父视图及其相应的 ViewModel 在该视图中我们选择项目 然后我们想要创建新的子视图 以编辑选择的详细信息 该子视图在 XAML 中
  • 为什么 ASP.NET Core Identity 2.0 授权过滤器导致我收到 404?

    我有一个控制器 我只想将其限制为特定角色 比方说admin 设置用户后admin角色 我可以使用以下命令验证他是否担任该角色IsInRoleAsync方法 返回 true 当设置属性时 Authorize Roles admin 我与同一个
  • Pimpl 与 unique_ptr :为什么我必须将接口构造函数的定义移至“.cpp”?

    只要我不移动构造函数的定义 B 到标题B h B h class Imp lt error here class B public std unique ptr
  • 尽管拥有正确的 NuGet 包,为什么我仍然需要在计算机上安装 MySQL 连接器?

    我有一个使用 MariaDB 和 Entity Framework 6 的 C ASP NET MVC 项目 这个项目是在 Visual Studio 2017 中制作的 我花了很长时间仔细检查是否以 NuGet 包的形式添加了正确的 My
  • Android 上的 Python 解释器

    所以我想在我的Android上练习python 有什么方法可以在我的设备上获取口译员或口译员模拟器吗 您可以使用termux app 链接到主页 这可以在谷歌市场并且不需要root 它是一个具有完整 Linux 环境的终端仿真器 通过apt
  • 在 R 中将千字节、兆字节等转换为字节

    R中是否有标准函数来转换表示字节数的字符串 例如 11855276K 113M 2 40G 到整数字节 我碰到humanReadable在 gdata 包中 但这会以相反的方式进行转换 我知道我可以解析该字符串 然后自己进行数学计算 但我想
  • Rails 中具有动态内容的侧栏设计模式

    我想要一个右侧栏 其中每个页面的内容都会发生变化 例如 当我在 朋友 页面时 侧栏应显示 新朋友 当我在帐户页面时 侧栏应显示最近的活动 我应该如何处理这个问题以尊重 Rails 设计模式 我听说过 Cells gem 但我不确定是否使用它
  • Nginx 不会重新启动。 。 。 nginx.service 的作业失败,因为控制进程退出并出现错误代码

    我正在关注一个关于设置 Nginx 的 YouTube 视频 我正在重新启动 当我得到其中的部分时 它给出了 我需要编辑服务器块文件 sites enabled default 我完全按照他们在视频中所做的操作 但是当保存并尝试重新启动时