Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Http Nginx正在运行但未提供服务_Http_Nginx - Fatal编程技术网

Http Nginx正在运行但未提供服务

Http Nginx正在运行但未提供服务,http,nginx,Http,Nginx,我正在为端口9001的所有HTTP流量配置代理传递 Nginx.conf #user nginx; worker_processes 1; #error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; #pid /var/run/nginx.pid; #include /etc/n

我正在为端口9001的所有HTTP流量配置代理传递

Nginx.conf

#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

#include /etc/nginx/modules.conf.d/*.conf;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    include /etc/nginx/sites-enabled/*;
    #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;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

  #include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
可用站点/itdb:

server {
    listen 80;
    location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://127.0.0.1:9001/;
    }
}
  • 我已验证可用的
    站点
    和启用的
    站点
    之间的符号链接是否正常,并已识别我的配置
  • 我没有收到任何错误,所有的
    nginx-t测试都成功了,没有问题
  • 我已尝试使用和不使用代理通行证上的尾随/选项

我有点不知所措,不知道还能找什么。有什么值得注意的吗?

您可以验证nginx是否正在运行,并使用类似和/或的东西绑定到端口80:

以下是OpenBSD上的
fstat

% fstat -u www | fgrep "*:"
www      nginx      21404   82* internet stream tcp 0xfffffe833a10d250 *:80
www      nginx      21404   83* internet6 stream tcp 0xfffffe833a10d480 *:80
以下是GNU/Linux上的
lsof

% lsof -i -n | fgrep nginx
nginx    24854        root    6u  IPv4 61955031      0t0  TCP *:http (LISTEN)
nginx    25047      nobody    6u  IPv4 61955031      0t0  TCP *:http (LISTEN)
此外,根据,我建议不要使用可用的
站点
/
已启用的站点
,因为这可能会给您带来额外的麻烦


下一步是从运行nginx的盒子内运行,和/或尝试查找数据包丢失的位置-也许您已经安装了防火墙?你有没有收到nginx的回复?可能是您的后端不可用吗?

您可以验证nginx是否正在运行并使用类似于和/或的内容绑定到端口80:

以下是OpenBSD上的
fstat

% fstat -u www | fgrep "*:"
www      nginx      21404   82* internet stream tcp 0xfffffe833a10d250 *:80
www      nginx      21404   83* internet6 stream tcp 0xfffffe833a10d480 *:80
以下是GNU/Linux上的
lsof

% lsof -i -n | fgrep nginx
nginx    24854        root    6u  IPv4 61955031      0t0  TCP *:http (LISTEN)
nginx    25047      nobody    6u  IPv4 61955031      0t0  TCP *:http (LISTEN)
此外,根据,我建议不要使用可用的
站点
/
已启用的站点
,因为这可能会给您带来额外的麻烦



下一步是从运行nginx的盒子内运行,和/或尝试查找数据包丢失的位置-也许您已经安装了防火墙?你有没有收到nginx的回复?可能是您的后端不可用吗?

这不是一个很好的答案,但我的解决方案是一个全新的OS&Nginx安装(尽管这些都是全新的)。我不确定什么是冲突的,但在我安装Nginx并复制配置的那一刻,一切都很好。

这不是一个很好的答案,但我的解决方案是一个新的操作系统&Nginx安装(尽管它们已经是新的)。我不确定是什么冲突,但在我安装Nginx并复制配置的那一刻,一切都很正常。

一个愚蠢的问题,你不会碰巧在一个网络中,主机的80端口被阻塞了,是吗?一点也不愚蠢,我来验证一下,这台服务器刚刚启动,因此可能是一个疏忽。Nmap检查80和443。您的nginx运行在哪个操作系统上?调用nginx时,您会遇到什么错误?一个愚蠢的问题,您不会碰巧在一个网络中,主机的80端口被阻塞,是吗?一点也不是愚蠢的问题,这不会超出可能的范围,让我验证一下,这台服务器刚刚启动,因此可能是一个疏忽。Nmap检查了80和443。您的nginx运行在哪个操作系统上?调用nginx时会出现什么错误?nginx没有绑定到端口,似乎任何操作都不正常。要尝试新安装的OS和Nginx。@CodeWasted,它是否正在运行?听起来它可能根本没有运行。它运行时没有问题(因为在服务中是活动的,没有故障),但就我所知,它没有做任何事情。@code你怎么知道它正在运行?你是怎么开始的?它在做什么,使您相信它完全运行没有问题?Systemctl启动它没有问题,当询问状态时,它显示所有活动/成功状态。当使用
nginx-t
时,这是一个完整的过程。nginx没有绑定到端口,似乎任何东西都不能正常工作。要尝试新安装的OS和Nginx。@CodeWasted,它是否正在运行?听起来它可能根本没有运行。它运行时没有问题(因为在服务中是活动的,没有故障),但就我所知,它没有做任何事情。@code你怎么知道它正在运行?你是怎么开始的?它在做什么,使您相信它完全运行没有问题?Systemctl启动它没有问题,当询问状态时,它显示所有活动/成功状态。当使用
nginx-t
时,这是一个完整的过程。在对您的评论中指出,“[…]可能有人在创建图像之前做了一些调整”。这听起来像docker。您是否可能使用docker compose来加速应用程序?如果是这样的话,并且考虑到你方不同的私有IP子网(例如拨入顶部的VPN)的参与,docker应用程序堆栈的地址与实际应用程序堆栈的地址之间可能存在轻微的IP地址冲突。如果容器仍然存在,您可以检查它以检查范围。在对您的评论中指出“[…]可能有人在创建图像之前做了一些调整”。这听起来像docker。您是否可能使用docker compose来加速应用程序?如果是这样的话,并且考虑到你方不同的私有IP子网(例如拨入顶部的VPN)的参与,docker应用程序堆栈的地址与实际应用程序堆栈的地址之间可能存在轻微的IP地址冲突。如果容器仍然存在,您可以检查它以检查范围。