【问题标题】:"nginx error!" while loading webpage“nginx错误!”加载网页时
【发布时间】:2016-01-04 12:59:34
【问题描述】:

背景:我已经安装并正在维护一个以 nginx 作为 Web 服务器的 OTRS v4.0 系统。系统一直在运行,直到我在 nginx.conf 中添加了 ssl 端口,从那时起,我试图连接到网页

http://localhost/otrs/index.pl

但没有响应并显示 nginx 错误!找不到您要查找的页面。

我从 nginx.conf 文件中删除了 ssl 部分,但我仍然无法恢复我之前的网页状态。

  • 在 error.log 文件中显示找不到 index.pl 文件 open() "/usr/share/nginx/html/otrs/index.pl" failed (2: No这样的文件或目录) 每当我点击 URL (http://localhost/otrs/index.pl) 时都会记录此消息。
  • 在 otrs.log 文件中,它只记录 PID。

有什么办法可以不用重新安装otrs吗?或我错过检查的任何其他日志文件

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
    #debug_connection 10.0.2.15;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        #listen       80;
        server_name  server.unixmen.local;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

?

提前致谢!

【问题讨论】:

  • 这看起来很像一个默认的 nginx 配置文件,您需要查看 /etc/nginx/conf.d 以查看其中的内容,因为此文件中没有配置 otrs 的内容。另外 - 这可能与 Stack Overflow 无关。
  • 嗨。目录 /etc/nginx/conf.d 是空的! @Sobrique
  • 嗯,这就是它不工作的原因。因为nginx里面什么都没有配置。
  • 嗨,我不明白 nginx 服务在机器上处于活动状态并启用。我需要重新安装nginx吗? @Sobrique
  • 你在那里有一个基本的 nginx 安装。通常在conf.d 中添加可选的额外内容。如果没有,你有一个“香草”配置,没有与任何东西集成。这就是它不起作用的原因。

标签: nginx otrs


【解决方案1】:

你混淆了你的默认服务器,而 nginx 试图提供错误的内容。

OTRS 使用 fastcgi,并且在 /etc/nginx/conf.d 目录中有自己的配置文件。您发布的文件是默认的 nginx 配置,与 OTRS 关系不大。

将您的监听指令更改为:

    #listen       80 default_server;
    listen       80;

这将阻止默认的 nginx 配置处理与https://localhost 的未知主机连接,并假设它以前工作过,那么系统应该再次工作。如果没有,那么从 /etc/nginx/conf.d/something.conf 发布 OTRS 配置,我们将能够看到发生了什么。

【讨论】:

  • 您好,尝试更改监听指令。它没有用。另外,如上一个答案中所述, /etc/nginx/conf.d 是空的! @Steve E.
  • 有趣。如果该站点以前工作过,那么某处肯定有一个 OTRS 特定的配置。你的文件/etc/nginx/default.d/*.conf 中也引用了这个文件夹呢?您在更改之前是否有备份?
【解决方案2】:

感谢您的回复。我得到了解决方案! 也许,从我的角度来看,这是一个愚蠢的错误;)

首先,我忘了在问题中提到我还在同一台机器上运行了另一个 Web 服务器,Apache。在初始阶段,两台服务器都配置在相同的端口 -> 80。因此,OTRS 在 Apache 而不是 nginx 上运行(我也将它用于另一个目的!)。后来,为了避免混淆,我将 Apache 配置中的端口从 80 更改为 8080,从这一刻起,服务器停止为 OTRS 提供服务。 所以现在,当我使用http://localhost:8080/otrs/index.pl 时,它工作正常。

下一次,我会非常小心地在处理多个 Web 服务器时明智地更改服务器配置。

【讨论】:

    猜你喜欢
    • 2022-11-13
    • 2021-07-29
    • 2021-10-26
    • 2013-10-29
    • 1970-01-01
    • 2022-12-14
    • 2017-01-03
    • 2013-03-06
    • 2021-03-19
    相关资源
    最近更新 更多