raighne
V2EX  ›  SSL

给 ghost 博客配置 ssl 证书失败。

  •  
  •   raighne · Nov 29, 2015 · 3123 views
    This topic created in 4002 days ago, the information mentioned may be changed or developed.

    修改 Nginx 配置文件为

    server {
    listen 80;
    listen [::]:80 ssl ipv6only=on;
    listen 443 ssl;
    listen [::]:443 ssl ipv6only=on;
    server_name 我的域名;
    ssl on;
    ssl_certificate /etc/ssl/private/example_com.crt;
    ssl_certificate_key /etc/ssl/private/example_com.key;
    }

    然后 nginx -t && nginx -s reload

    提示 nginx: [warn] conflicting server name "我的域名" on 0.0.0.0:80, ignored
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    nginx: [warn] conflicting server name "我的域名" on 0.0.0.0:80, ignored

    请教各位哪里错了

    10 replies  •  2015-12-02 11:01:22 +08:00
    ixiaozhi
    ixiaozhi
    Nov 29, 2015
    1
    能不能把我的域名几个字改了啊。。。
    raighne
    raighne
    OP
    Nov 29, 2015❤️1
    2
    @ixiaozhi 为了不暴露我的域名,我就用这四个字代替了
    Pastsong
    Pastsong
    Nov 29, 2015
    3
    为什么要加 ipv6only=ture ,(既然它不是 ipv6 only 的)
    Pastsong
    Pastsong
    Nov 29, 2015
    4
    根据你的错误信息应该是你在别的哪里还有一个"我的域名"的配置,检查你的 sites-enable/ 或 conf.d/
    Showfom
    Showfom
    PRO
    Nov 29, 2015
    5
    conflicting server name

    那么明显的错误提示
    kozora
    kozora
    Nov 29, 2015❤️2
    6
    @raighne 哈哈 受黑暗森林打击荼毒的啊 233
    oott123
    oott123
    Nov 29, 2015
    7
    博客不就是给别人看的,打码干啥。
    5# 正解(
    alect
    alect
    Nov 29, 2015
    8
    80 端口监听 SSL ?
    tcdw
    tcdw
    Nov 30, 2015 via Android
    9
    看到你前面连续定义了两次端口。。
    我猜你是希望强制跳转到 https 版本吧
    如果是这样的话,你可以这样写:

    server {
    listen 80;
    server_name www.example.com;
    rewrite ^/(.*)$ https://www.example.com/$1 permanent;
    }

    上面这段配置文件的作用就是,当访客访问到 https://www.example.com/blahblah 时,就会被重定向到 https://www.example.com/blahblah 。
    然后把你配置文件中的

    listen 80;
    listen [::]:80 ssl ipv6only=on;

    删除,再重启服务,应该就可以工作了。
    raighne
    raighne
    OP
    Dec 2, 2015
    10
    @tcdw 感谢,已经配置好了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2295 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 03:59 · PVG 11:59 · LAX 19:59 · JFK 22:59
    ♥ Do have faith in what you're doing.