设为首页 加入收藏

TOP

Typecho搭建和美化(三)
2023-07-23 13:31:35 】 浏览:65
Tags:Typecho
的证书,右侧下载Nginx证书
  • 将 hupifeng.cn_bundle.crt,hupifeng.cn.key 两个文件拷贝到此目录/local/lighthouse/softwares/nginx/certificates)
  • 查看 /usr/local/lighthouse/softwares/nginx/conf/include 路径下 hupifeng.cn.conf(如果没有对应域名的配置文件,手动添加)
  • # https hupifeng.cn.conf 的配置
    # "hupifeng.cn"相关的五个地方需要手动修改成自己的域名
    
    server {
      listen 443 ssl;
      server_name hupifeng.cn;
      server_tokens off;
      keepalive_timeout 10;
      ssl_certificate /usr/local/lighthouse/softwares/nginx/certificates/hupifeng.cn_bundle.crt;
      ssl_certificate_key /usr/local/lighthouse/softwares/nginx/certificates/hupifeng.cn.key;
      ssl_session_timeout 5m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
      ssl_prefer_server_ciphers on;
    
      index index.php index.html;
    
      root /usr/local/lighthouse/softwares/typecho;
      if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php$1 last;
      }
    
      location ~ .*\.php(\/.*)*$ {
        include fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;
      }
    
      # 禁 止 访 问 的 文 件 或 目 录
      location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) {
        return 404;
      }
    
      location ~ \.well-known {
        allow all;
      }
    
      access_log "logs//hupifeng.cn.log";
      error_log "logs//hupifeng.cn.error.log";
    }
    

    设置 HTTP 请求自动跳转 HTTPS

    # 作用,下次打开http链接会自动转到https
    # 在 hupifeng.cn.conf 文件后继续追加如下内容
    
    server {
        listen 80;
        #请 填 写 绑 定 证 书 的 域 名
        server_name hupifeng.cn;
        #把 http的 域 名 请 求 转 成 https
        return 301 https://$host$request_uri;
    }
    

    启用、重启nginx

    # 查看Nginx进程运行状态
    ps -ef | grep nginx
    
    # 开启、停止、重启
    cd /usr/local/lighthouse/softwares/nginx/sbin
    
    ./nginx
    
    ./nginx -s stop
    
    ./nginx -s reload
    
    # 或者一条命令重启
    /usr/local/lighthouse/softwares/nginx/sbin/nginx -s reload
    
    首页 上一页 1 2 3 4 下一页 尾页 3/4/4
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    上一篇关于ArchLinux 在 Wayland 环境下.. 下一篇【Linux】(小白向)详解VirtualBox..

    最新文章

    热门文章

    Hot 文章

    Python

    C 语言

    C++基础

    大数据基础

    linux编程基础

    C/C++面试题目