raighne
V2EX  ›  SSL

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

  •  
  •   raighne · Nov 29, 2015 · 2890 views
    This topic created in 3865 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
        1
    ixiaozhi  
       Nov 29, 2015
    能不能把我的域名几个字改了啊。。。
    raighne
        2
    raighne  
    OP
       Nov 29, 2015   ❤️ 1
    @ixiaozhi 为了不暴露我的域名,我就用这四个字代替了
    Pastsong
        3
    Pastsong  
       Nov 29, 2015
    为什么要加 ipv6only=ture ,(既然它不是 ipv6 only 的)
    Pastsong
        4
    Pastsong  
       Nov 29, 2015
    根据你的错误信息应该是你在别的哪里还有一个"我的域名"的配置,检查你的 sites-enable/ 或 conf.d/
    Showfom
        5
    Showfom  
    PRO
       Nov 29, 2015
    conflicting server name

    那么明显的错误提示
    kozora
        6
    kozora  
       Nov 29, 2015   ❤️ 2
    @raighne 哈哈 受黑暗森林打击荼毒的啊 233
    oott123
        7
    oott123  
       Nov 29, 2015
    博客不就是给别人看的,打码干啥。
    5# 正解(
    alect
        8
    alect  
       Nov 29, 2015
    80 端口监听 SSL ?
    tcdw
        9
    tcdw  
       Nov 30, 2015 via Android
    看到你前面连续定义了两次端口。。
    我猜你是希望强制跳转到 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
        10
    raighne  
    OP
       Dec 2, 2015
    @tcdw 感谢,已经配置好了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5809 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 327ms · UTC 02:36 · PVG 10:36 · LAX 19:36 · JFK 22:36
    ♥ Do have faith in what you're doing.