Nginx错误:fedora服务器上的502 Bad Gateway

时间:2019-07-25 04:03:34

标签: nginx proxy fedora bad-gateway

我对nginx有问题,我不知道如何解决此错误,我的nginx.conf看起来像这样:

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

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

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 4096;

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

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

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        location / {
        }

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

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
        return 301 https://$host$request_uri;
    }

}

我的日志显示如下错误:

2019/02/20 10:56:24 [warn] 32162#0: conflicting server name "example.com" on 0.0.0.0:80, ignored
2019/02/20 10:56:24 [warn] 32162#0: conflicting server name "example.com" on 0.0.0.0:443, ignored
2019/02/20 11:01:24 [emerg] 32260#0: "server" directive is not allowed here in /etc/nginx/default.d/default.conf:3
2019/02/20 11:09:01 [emerg] 32378#0: "server" directive is not allowed here in /etc/nginx/default.d/default.conf:1
2019/02/20 11:10:17 [warn] 32421#0: could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
2019/02/20 11:10:17 [warn] 32422#0: could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
2019/02/20 11:12:41 [warn] 32450#0: could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
2019/02/20 11:16:01 [emerg] 32501#0: unknown directive "ignoring" in /etc/nginx/nginx.conf:29
2019/02/20 11:24:04 [emerg] 32614#0: "server" directive is not allowed here in /etc/nginx/conf.d/default.conf:1
2019/02/20 11:24:26 [emerg] 32623#0: "server" directive is not allowed here in /etc/nginx/conf.d/default.conf:1

和我的default.conf看起来像这样

server {
        listen  80;
        listen 443 ssl;

        ssl on;
        ssl_certificate /etc/nginx/ssl/example_com.pem;
        ssl_certificate_key /etc/nginx/ssl/example_com.key;

        server_name example.com;
        access_log /var/log/nginx/nginx.vhost.access.log;
        error_log /var/log/nginx/nginx.vhost.error.log;

        location / {
                proxy_pass https://example.com:8443/;
        }
}

请帮助我解决此错误,一切提示或使我了解如何解决此错误将使我感到高兴,谢谢。

0 个答案:

没有答案