微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

部署Nginx服务器并在另一台机器上打开它时出现问题,对proxy_pass和portforward表示怀疑

如何解决部署Nginx服务器并在另一台机器上打开它时出现问题,对proxy_pass和portforward表示怀疑

我正在尝试部署Nginx服务器,但遇到一些问题,日志文件显示如下:

2020/10/13 16:30:57 [alert] 6850#6850: *28901 socket() Failed (24: Too many open files) while connecting to upstream,client: 127.0.0.1,server: eduardo.ecadem1998.com,request: "GET / HTTP/1.1",upstream: "http://127.0.0.1:80/",host: "eduardo.ecadem1998.com"

我找到了一些解决方案,但是后来发生了:

2020/10/13 16:28:17 [alert] 6743#6743: *7259 4096 worker_connections are not enough while connecting      to upstream,host: "eduardo.ecadem1998.com"

我在寻找可以解决这些问题的答案,但第一个错误再次出现在循环中。

这是我的文件

可用的站点

upstream eduardo.ecadem1998.com {
   server 127.0.0.1:80;
}

server {
    listen 80;
    listen [::]:80;

    root /var/www/eduardo.com;

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

    server_name eduardo.ecadem1998.com;

    access_log /var/log/Nginx/eduardo.access.log;
    error_log /var/log/Nginx/eduardo.error.log;

    location / {
            try_files $uri $uri/ =404;
            proxy_pass http://eduardo.ecadem1998.com;

            proxy_http_version 1.1;
    }
    location ~ /\.ht {
            deny all;
    }
}

Nginx.conf:

user www-data;
worker_processes auto;
pid /run/Nginx.pid;
include /etc/Nginx/modules-enabled/*.conf;
worker_rlimit_nofile 16384;


events {
    worker_connections 20000;
}

http {

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

    server_names_hash_bucket_size 64;

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

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3,ref: POODLE
    ssl_prefer_server_ciphers on;

    access_log /var/log/Nginx/access.log;
    error_log /var/log/Nginx/error.log;

    gzip on;

    include /etc/Nginx/conf.d/*.conf;
    include /etc/Nginx/sites-enabled/*;
}

我的主机文件

127.0.0.1       localhost

127.0.1.1       Cortana

127.0.0.1       eduardo.ecadem1998.com

此外,在搜索时,我发现我必须配置路由器以允许向服务器发送请求,因此我尝试进行portforward。 Firewall config screenshot WAN info

portforward Portforward screenshot

我为自己的愚蠢错误表示歉意,不久前我开始使用Nginx,感谢您的帮助!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。