{"id":1074,"date":"2021-08-02T16:49:30","date_gmt":"2021-08-02T08:49:30","guid":{"rendered":"http:\/\/www.dxQerp.com\/?p=1074"},"modified":"2021-09-03T08:09:42","modified_gmt":"2021-09-03T00:09:42","slug":"how-to-create-and-install-self-signed-certificate-in-apache","status":"publish","type":"post","link":"http:\/\/www.dxQerp.com\/?p=1074","title":{"rendered":"How to Create and Install Self Signed Certificate in Apache"},"content":{"rendered":"<p>SSL \u53ef\u7528\u65bc\u7528\u6236\u548c Web \u670d\u52d9\u5668\u4e4b\u9593\u7684\u5b89\u5168\u901a\u4fe1\u3002<br \/>\n\u8b49\u66f8\u5728\u516c\u5171\u7dda\u8def\u4e0a\u5c0d\u6578\u64da\u9032\u884c\u52a0\u5bc6\uff0c\u56e0\u6b64\u53ef\u4ee5\u514d\u53d7\u9ed1\u5ba2\u653b\u64ca\u3002<br \/>\n\u81ea\u5df1 \u767c\u884c\u7684\u7c3d\u540d\u8b49\u66f8\u53ef\u4ee5\u514d\u8cbb\u4f7f\u7528\uff0c\u4f46\u4e0d\u80fd\u5728\u4f7f\u7528\u5728<strong>\u4fe1\u7528\u5361<\/strong> \u6216\u662f <strong>PayPal<\/strong>&nbsp; \u4fe1\u606f\u7b49\u6a5f\u5bc6\u6578\u64da\u7684\u751f\u7522\u74b0\u5883\u4e2d\u4f7f\u7528\u3002<\/p>\n<h4><span style=\"color: #000000;\"><strong>Step 1 \u2013 \u5b89\u88dd mod_ssl Package<\/strong><\/span><\/h4>\n<p>\u70ba\u4e86\u8a2d\u7f6e SSL \u8b49\u66f8\uff0c\u8acb\u78ba\u4fdd\u60a8\u7684\u7cfb\u7d71\u4e0a\u5b89\u88dd\u4e86 mod_ssl\u3002 \u5982\u679c\u5c1a\u672a\u5b89\u88dd\uff0c\u8acb\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u5b89\u88dd\u3002 \u6b64\u5916\uff0c\u5b89\u88dd OpenSSL \u5305\u4ee5\u5275\u5efa\u8b49\u66f8\u3002<\/p>\n<p><span style=\"color: #800000;\">dnf install mod_ssl openssl<\/span><\/p>\n<h4><strong>Step 2 \u2013 \u5efa\u7acb\u5c6c\u65bc\u81ea\u5df2\u767c\u884c\u7684 \u8a8d\u8b49\u4e2d\u5fc3<\/strong><\/h4>\n<p>\u5b89\u88dd mod_ssl \u548c OpenSSL \u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u70ba\u60a8\u7684\u57df\u5275\u5efa\u81ea\u7c3d\u540d\u8b49\u66f8\u3002(\u6216\u662f\u67e5\u770b)<\/p>\n<pre><span style=\"color: #800000;\">mkdir -p \/etc\/pki\/tls\/certs<\/span>  # \u5efa\u7acb \u76ee\u9304\n<span style=\"color: #800000;\">cd \/etc\/pki\/tls\/certs<\/span>        # \u8f49\u9032 \u8def\u5f91 (\u7576\u524d\u76ee\u9304)\n\n\u5efa\u7acb \u65b0\u7684 SSL \u8b49\u66f8\n<span style=\"color: #800000;\">openssl req -x509 -nodes -newkey rsa:2048 -keyout <strong>first<\/strong><strong>.com.key<\/strong> -out <strong>first<\/strong><strong>.com.crt<\/strong><\/span><\/pre>\n<pre><span style=\"color: #800000;\">openssl req -x509 -nodes -newkey rsa:2048 -days 1825 -keyout <strong>first.com.key<\/strong> -out <strong>first<\/strong><strong>.com.crt <\/strong><\/span><\/pre>\n<pre>\u4e0a\u8ff0\u547d\u4ee4\u5c07\u5728<strong>\u7576\u524d\u76ee\u9304<\/strong>\u4e2d\u5275\u5efa\u4e00\u500b ssl \u5bc6\u9470\u6587\u4ef6 <span style=\"color: #800000;\"><strong>first<\/strong><\/span><strong><span style=\"color: #800000;\">.com.key<\/span><\/strong> \u548c\u4e00\u500b\u8b49\u66f8\u6587\u4ef6 <span style=\"color: #800000;\"><strong>first<\/strong><\/span><span style=\"color: #800000;\"><strong>.com.crt <\/strong><\/span><\/pre>\n<h4><strong>Step 3 \u2013 \u5728 Apache \u914d\u7f6e SSL \u865b\u64ec\u4e3b\u6a5f port 443<\/strong><\/h4>\n<p>\/etc\/httpd\/conf.d\/<span style=\"color: #000000;\">dxqerp<\/span>.com_ssl.conf&nbsp; #&nbsp; \u5efa\u7acb SSL \u865b\u64ec\u4e3b\u6a5f \u74b0\u5883\u8a2d\u5b9a \u6a94<\/p>\n<p>&lt;VirtualHost *:443&gt;<br \/>\nServerAdmin admin@first.com<br \/>\nDocumentRoot \/var\/www\/first.com<\/p>\n<p>ServerName first.com<br \/>\nServerAlias www.first.com<\/p>\n<p>&lt;Directory \/var\/www\/first.com&gt;<br \/>\n#Allowoverride all ###Uncomment if required<br \/>\n&lt;\/Directory&gt;<\/p>\n<p>SSLEngine on # \u5c07\u6b64\u8a2d\u7f6e\u70ba\u201c\u958b\u201d<br \/>\nSSLCertificateFile \/etc\/pki\/tls\/certs\/first.com.crt # \u8a2d\u7f6e SSL \u8b49\u66f8\u7684\u4f4d\u7f6e<br \/>\nSSLCertificateKeyFile \/etc\/pki\/tls\/certs\/first.com.key # \u8a2d\u7f6e SSL \u79c1\u9470\u8b49\u66f8\u7684\u4f4d\u7f6e<\/p>\n<p>ErrorLog logs\/first.com_ssl-error.log<br \/>\nCustomLog logs\/first.com_ssl-access.log combined<br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<h4 class=\"heading1\">Step 4 \u2013 \u91cd\u555f Apache<\/h4>\n<p><span style=\"color: #800000;\">systemctl restart httpd<\/span><\/p>\n<h4><strong>Step 5 \u2013 \u4f7f\u7528 HTTPS \u6e2c\u8a66\u7db2\u7ad9<\/strong><\/h4>\n<p><span style=\"color: #800000;\">https:\/\/www<strong>.first<\/strong>.com<\/span><\/p>\n<p>\u6700\u5f8c\uff0c\u4f7f\u7528 https \u5728\u60a8\u559c\u6b61\u7684 Web \u700f\u89bd\u5668\u4e2d\u6253\u958b\u60a8\u7684\u7ad9\u9ede\u3002<\/p>\n<p>\u5b83\u9700\u8981\u6253\u958b<strong>\u7aef\u53e3 443<\/strong> \u624d\u80fd\u4f7f\u7528 https \u8a2a\u554f\u7ad9\u9ede.<\/p>\n<p>\u7531\u65bc\u6211\u5011\u4f7f\u7528\u7684\u662f\u81ea\u5df1\u767c\u884c\u7684\u8b49\u66f8\uff0c\u60a8\u5c07\u5728\u700f\u89bd\u5668\u4e2d\u6536\u5230\u4e00\u689d\u8b66\u544a\u6d88\u606f\u3002 \u60a8\u53ef\u4ee5<strong>\u7c21\u55ae\u5730\u5ffd\u7565<\/strong>\u6b64\u6d88\u606f.<\/p>\n<p><strong>THE END<\/strong><\/p>\n<p><strong>\u53c3\u8003<\/strong><\/p>\n<p><a href=\"https:\/\/tecadmin.net\/create-and-install-self-signed-certificate-in-apache\/\">How to Create and Install Self Signed Certificate in Apache<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSL \u53ef\u7528\u65bc\u7528\u6236\u548c Web \u670d\u52d9\u5668\u4e4b\u9593\u7684\u5b89\u5168\u901a\u4fe1\u3002 \u8b49\u66f8\u5728\u516c\u5171\u7dda\u8def\u4e0a\u5c0d\u6578\u64da\u9032\u884c\u52a0\u5bc6\uff0c\u56e0\u6b64\u53ef\u4ee5\u514d\u53d7\u9ed1\u5ba2\u653b\u64ca\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1132,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[29],"tags":[],"class_list":["post-1074","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aapache"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.dxQerp.com\/wp-content\/uploads\/2021\/08\/HTTP-SERVER-TEST-PAGE-SSL.png?fit=407%2C291","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1074","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1074"}],"version-history":[{"count":3,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1074\/revisions"}],"predecessor-version":[{"id":1151,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/posts\/1074\/revisions\/1151"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=\/wp\/v2\/media\/1132"}],"wp:attachment":[{"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dxQerp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}