0
点赞
收藏
分享

微信扫一扫

【从浅学到熟知Linux】环境变量详谈(含使用程序获取环境变量的3种方法、如何查看环境变量)

快乐码农Alan007 2天前 阅读 2

本次实验背景:
完全参考官方 https://cloud.tencent.com/document/product/400/4143 文档流程,没有搞定,于是写下避坑之作。

服务器:腾讯云轻量应用服务器
操作系统: Windows Server 2022 DataCenter 64bit CN
apache版本:Apache 2.4.59

证书下载及存放

  1. 下载证书
    这里完全按照官方的来
    在这里插入图片描述
  2. 证书存放
    如下图所示,为方便管理和引用,我在服务器的conf下新建了目录ssl,把需要用到的三个证书(除CSR外)放到这里
    在这里插入图片描述

一、开启ssl配置文件

  1. 使用文本编辑器,打开 Apache 服务器 conf 目录下 httpd.conf 文件,并删除以下字段前 # 注释符。
#LoadModule ssl_module modules/mod_ssl.so
#Include conf/extra/httpd-ssl.conf

在这里插入图片描述
在这里插入图片描述
2. 将httpd-ssl.conf中虚拟机部分代码注释
在这里插入图片描述
在这里插入图片描述

二、配置虚拟机

打开Apache24\conf\extra\目录,将httpd-vhosts.conf复制一份备份,清空httpd-vhosts.conf内容加入下面内容,*****包含作者真实域名信息,打了马赛克。

<VirtualHost *:80>
    DocumentRoot "C:\WF\www\html\****"
   <Directory "C:\WF\www\html\****">
        RewriteEngine on
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "C:\WF\www\html\****"
    ServerName ****.com
    ServerAlias www.****.com
    #ssl
    SSLEngine on
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "${SRVROOT}/cgi-bin">
    SSLOptions +StdEnvVars
    </Directory>
    #ssl-key
    SSLCertificateFile "${SRVROOT}/conf/ssl/****.com.crt"
    SSLCertificateKeyFile "${SRVROOT}/conf/ssl/****.com.key"
    SSLCertificateChainFile "${SRVROOT}/conf/ssl/root_bundle.crt"
    #ssl-key-END
    BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

    #   Per-Server Logging:
    #   The home of a custom SSL log file. Use this when you want a
    #   compact non-error SSL logfile on a virtual host basis.
    CustomLog "${SRVROOT}/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

在这里插入图片描述

三、测试配置文件+重启apache服务

net stop apache
httpd -t
net start apache
举报

相关推荐

【Linux】环境变量

linux 环境变量

0 条评论