NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
songkqx1c
V2EX  ›  NGINX

ssl 证书要怎么安装到 nginx?

  •  
  •   songkqx1c · Jun 10, 2017 · 5446 views
    This topic created in 3267 days ago, the information mentioned may be changed or developed.
    申请了免费的 TrustAsia-DV 证书,解压出来 nginx 目录下两个文件:private.key 和 public.pem
    服务器环境是 oneinstack 搭建的 lnmp,vhost 下已经开启 http 跳转 https 了 但是证书怎么安装到 nginx?直接把这俩文件传到 /ssl 下不行。
    25 replies    2017-06-12 08:35:31 +08:00
    songkqx1c
        1
    songkqx1c  
    OP
       Jun 10, 2017
    为什么我申请的证书木有.crt 文件
    acrisliu
        2
    acrisliu  
       Jun 10, 2017 via Android
    Emi
        3
    Emi  
    PRO
       Jun 10, 2017
    conf 规则内开启 ssl
    同时 ssl 路径正确就 OK 了。
    yesono
        4
    yesono  
       Jun 10, 2017
    pem=crt,替换 key、crt 注意名字即可
    songkqx1c
        5
    songkqx1c  
    OP
       Jun 10, 2017
    @yesono 把.pem 改为.crt ?
    shiji
        6
    shiji  
       Jun 10, 2017
    @songkqx1c 本质上这个文件不讲究后缀,你改成 php 后缀也一样行
    songkqx1c
        7
    songkqx1c  
    OP
       Jun 10, 2017
    @shiji 呃 传上去了 也在 vhost 指定了,测试 nginx 提示 [emerg] BIO_new_file("/usr/local/nginx/conf/ssl/public.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/nginx/conf/ssl/public.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file) 怎么办
    songkqx1c
        8
    songkqx1c  
    OP
       Jun 10, 2017
    @shiji @yesono @Emi 谢谢 已经配置好了~~~~~不过我的 https 为什么没有绿色!!?
    xspoco
        9
    xspoco  
       Jun 10, 2017
    oneinstack 怎么不用内置的 Let ’ s Encrypt
    songkqx1c
        10
    songkqx1c  
    OP
       Jun 10, 2017
    @xspoco 因为没听说过。。
    shiji
        11
    shiji  
       Jun 10, 2017
    @songkqx1c 没绿色一般是因为网页里面有不是 https 的图片,js,css 之类的,改了应该就行了
    songkqx1c
        12
    songkqx1c  
    OP
       Jun 10, 2017
    @shiji 对对
    Showfom
        13
    Showfom  
    PRO
       Jun 10, 2017   ❤️ 1
    songkqx1c
        14
    songkqx1c  
    OP
       Jun 10, 2017
    wordpress 开启 HTTPS 后怎么把图片链接全转成 https,网上方式只能转 css js 文件啊 @shiji@showfom
    Showfom
        15
    Showfom  
    PRO
       Jun 10, 2017
    @songkqx1c 改数据库 替换图片地址
    songkqx1c
        16
    songkqx1c  
    OP
       Jun 10, 2017
    @Showfom 改完了 首页还是不显绿 哈哈
    zuolan
        17
    zuolan  
       Jun 11, 2017
    @songkqx1c F12 看看什么资源没有上 https 咯。会有显示的。
    Devmingwang
        18
    Devmingwang  
       Jun 11, 2017
    贴一份我的 ssl 配置(在 nginx/sites-enbled/default )

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

    listen 443 ssl;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name your_domain.com;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;

    location / {
    try_files $uri $uri/ =404;
    }
    }
    Showfom
        19
    Showfom  
    PRO
       Jun 11, 2017
    @songkqx1c 哈哈 按 F12 看看有什么资源还是 http 的
    Showfom
        20
    Showfom  
    PRO
       Jun 11, 2017
    留个网址帮你检查下呀- -
    lslqtz
        21
    lslqtz  
       Jun 11, 2017
    @Showfom 这个文档真心详细。。样式也好看 :-3
    ydxred
        22
    ydxred  
       Jun 11, 2017
    这个问题!我的 302 跳转页有问题!但是开启 https 访问的慢...
    owt5008137
        23
    owt5008137  
       Jun 11, 2017 via Android
    RTFM
    devopscode
        24
    devopscode  
       Jun 11, 2017
    如果是旗下的 ssl 需要合并证书的,你可以参考他们官方文档.
    songkqx1c
        25
    songkqx1c  
    OP
       Jun 12, 2017
    @Showfom 上次已经弄好啦 前后台都是原谅色了!我的
    @ydxred 我感觉速度没有差异,OS 配置环境的时候可以选择开启 https 设置 http 强制跳转 https 所以搭建完后不用再自己配跳转 只要替换证书就行。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2559 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 58ms · UTC 15:51 · PVG 23:51 · LAX 08:51 · JFK 11:51
    ♥ Do have faith in what you're doing.