加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – nginx:[emerg]一个重复的默认服务器

发布时间:2020-12-16 23:26:37 所属栏目:百科 来源:网络整理
导读:当我尝试重启nginx并在控制台中写入此命令时 nginx -t 我有一个错误: nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default.save:20nginx: configuration file /etc/nginx/nginx.conf test failed 启用站点-/默
当我尝试重启nginx并在控制台中写入此命令时

nginx -t

我有一个错误:

nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default.save:20
nginx: configuration file /etc/nginx/nginx.conf test failed

启用站点-/默认

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        server_name localhost;
        passenger_enabled on;
        rails_env    production;
        root         /home/hh/public;

        access_log  /var/log/nginx/host.access.log;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
}

nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
}

http {

        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;


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

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

一小时前一切正常,但重启后nginx我有这个问题.

解决方法

如果你看一下/ etc / nginx / sites-enabled /你看到两个文件,default.save和default只删除其中一个
sudo rm -rf  /etc/nginx/sites-enabled/default.save

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读