CA证书(网络建设与运维)

下载openssl*软件包

yum install -y openssl*

之后cd到/etc/pki/CA/文件夹中创建证书

cd /etc/pki/CA

openssl genrsa -out private/cakey.pem 2048

openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650

根据题目输入证书信息

在创造申请证书

openssl genrsa -out skills.key 2048

openssl req -new -key skills.key -out skills.csr

根据题目填写申请证书信息

创造一个文件

vim sign.cnf

subjectAltName=DNS:*skills.com,DNS=skills.com

openssl ca -in skills.csr -out skills.crt -days 1825 -extfile sign.cnf

配置http服务

yum install -y httpd* mod_ssl*

vim /etc/httpd/conf/httpd.conf

在最后一行编辑80端口的http

<VirtualHost*:80> 定义http 80 网站 疑问:http每个选项的用意以及用法

DocumentRoot "/var/www/html"

ServerName linux1.skills.com

RewriteEngine On

RewriteRule ^/(.*)$ https://www.skills.com/$1 [R=301] 自动跳转域名www.skills.com

<Directory "/">

Requrie all granted

</Directory>

</VirtualHost>

<VirtualHost *:80> http 80端口ip禁止访问代码

ServerName 10.4.220.101

Redirect 403/

</VirtualHost>

配置https服务

vim /etc/httpd/conf.d/ssl.conf

将开头defualt_改成*

定义目录和域名

然后定义证书和私钥

在最后一行编辑

<VirtualHost *:443> https 443端口ip禁止访问代码

ServerName 10.4.220.101

sslengine on

sslcertificatefile /etc/ssl/skills.crt

sslcertificatekeyfile /etc/ssl/skills.key

redirect 403 /

</VirtualHost>

openssl pkcs12 -export -inkey skills.key -in skills.crt -out skills.pfx

openssl pkcs12 -in skills.pfx -out skills.pem -nodes

openssl rsa -in skills.pem -out apache.key

openssl x509 -in skills.pem -out apahce.crt

将cacert.pem和skills.pfx导入到桌面当中,把cacert.pem的后缀改成cer然后安装证书,安装到受信任根证书

pfx证书导入到浏览器的个人证书里面.

tomcat服务以及nginx服务的http,https,反向代理

{虚拟机3和4安装

yum install -y java-17-openjdk* tomcat*

然后再3和4上编辑在最后一行

vim /etc/profile

export JAVA_HOME=/usr/lib/jvm/java-17

export PATH=JAVA(下划线)Home/bin:PATH

source /etc/profile #资源加载

vim /usr/lib/systemd/system/tomcat.service #3和4虚拟机的tomcat配置文件将tomcat改成root用户

vim /etc/tomcat/server.xml} ; #详细内容去word文档查看

相关推荐
科技快报4 小时前
中兴移动互联终端三剑齐发 AI、5G-A、WiFi7构建高效智能网络
网络·人工智能·5g
Alfred young4 小时前
CS144 Lab Checkpoint 6: building an IP router
网络·tcp/ip·智能路由器
GalaxyPokemon5 小时前
LINUX网络基础 [一] - 初识网络,理解网络协议
linux·运维·网络
alien爱吃蛋挞5 小时前
【JavaEE】网络原理
网络·java-ee
ling-456 小时前
ifconfig 不显示 Linux 虚拟机常规网卡的 IP 地址
服务器·网络·php
菜菜小蒙6 小时前
【Linux】http 协议
网络·网络协议·http
钟离墨笺7 小时前
【Linux】【网络】UDP打洞-->不同子网下的客户端和服务器通信(未成功版)
linux·服务器·网络