{"id":1064,"date":"2024-02-25T22:09:33","date_gmt":"2024-02-25T13:09:33","guid":{"rendered":"https:\/\/shinke1987.net\/?p=1064"},"modified":"2024-03-14T09:16:37","modified_gmt":"2024-03-14T00:16:37","slug":"https%e3%81%a7%e3%81%ae%e9%96%8b%e7%99%ba%e7%92%b0%e5%a2%83%e6%a7%8b%e7%af%89","status":"publish","type":"post","link":"https:\/\/shinke1987.net\/?p=1064","title":{"rendered":"https\u3067\u306e\u958b\u767a\u74b0\u5883\u69cb\u7bc9"},"content":{"rendered":"\n<h2 id=\"toc0\" class=\"wp-block-heading\">SSL\/TLS\u3067\u306e\u901a\u4fe1\u306e\u305f\u3081\u306b\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u6e96\u5099<\/h2>\n\n\n\n<h3 id=\"toc1\" class=\"wp-block-heading\">\u74b0\u5883<\/h3>\n\n\n\n<p>openssl v3.2.1<\/p>\n\n\n\n<h3 id=\"toc2\" class=\"wp-block-heading\">\u79d8\u5bc6\u9375\u3092\u4f5c\u6210<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ openssl genpkey -out private.key -algorithm RSA\n<\/pre><\/div>\n\n\n<h3 id=\"toc3\" class=\"wp-block-heading\">\u8a3c\u660e\u66f8\u7f72\u540d\u8981\u6c42\u3092\u4f5c\u6210\uff08\u8a3c\u660e\u66f8\u4f5c\u6210\u306e\u305f\u3081\u306b\u4f5c\u6210\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ openssl req -new -key private.key -out apache.csr\n<\/pre><\/div>\n\n\n<p>\u4e0a\u8a18\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u6642\u306e\u3001\u5165\u529b\u5fc5\u9808\u9805\u76ee\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Country Name<br>\u56fd\u540d\uff08JP\uff09<\/li>\n\n\n\n<li>Organization Name<br>\u7d44\u7e54\u540d<\/li>\n\n\n\n<li>Common Name<br>\u30b5\u30fc\u30d0\u306eFQDN<\/li>\n<\/ul>\n\n\n\n<h3 id=\"toc4\" class=\"wp-block-heading\">\u8a3c\u660e\u66f8\u3092\u4f5c\u6210<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ openssl x509 -in apache.csr -out apache.crt -req -signkey private.key -days 3650\n<\/pre><\/div>\n\n\n<p>\u6b21\u306e\u8868\u793a\u304c\u51fa\u3066\u3001apache.crt\u304c\u4f5c\u6210\u3055\u308c\u308b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nCertificate request self-signature ok\nsubject=C = JP, ST = Some-State, O = TestCompany, CN = \u8a2d\u5b9a\u3057\u305fFQDN\n<\/pre><\/div>\n\n\n<h2 id=\"toc5\" class=\"wp-block-heading\">\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\uff08\u57fa\u672c\u7684\u306b\u904e\u53bb\u306e\u3082\u306e\u3092\u5f15\u304d\u7d99\u3044\u3067\u7de8\u96c6\u3057\u3066\u3044\u308b\uff09<\/h2>\n\n\n\n<h3 id=\"toc6\" class=\"wp-block-heading\">\u904e\u53bb\u306e\u53c2\u8003<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/shinke1987.net\/?p=979\">Docker\u3067\u7df4\u7fd2\u7528Apache+PHP\u74b0\u5883<\/a><a href=\"https:\/\/shinke1987.net\/?p=979\" target=\"_blank\" rel=\"noreferrer noopener\">\u3092<\/a><a href=\"https:\/\/shinke1987.net\/?p=979\">\u6e96\u5099<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/shinke1987.net\/?p=1016\" target=\"_blank\" rel=\"noreferrer noopener\">xDebug\u3092\u4f7f\u3048\u308b\u3088\u3046\u306bDocker\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/a><\/li>\n<\/ul>\n\n\n\n<h3 id=\"toc7\" class=\"wp-block-heading\">default-ssl.conf<\/h3>\n\n\n\n<p>\u7de8\u96c6\u5185\u5bb9\u306f\u6b21\u306e5\u70b9<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ServerName<\/li>\n\n\n\n<li>DocumentRoot<\/li>\n\n\n\n<li>DirectoryIndex<\/li>\n\n\n\n<li>SSLCertificateFile<\/li>\n\n\n\n<li>SSLCertificateKeyFile<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;VirtualHost *:443&gt;\n\tServerAdmin webmaster@localhost\n\n\tServerName \u30b5\u30a4\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u3092\u6307\u5b9a\n\n\tDocumentRoot \/var\/www\/html\/public\n    DirectoryIndex index.php\n\n    SSLCertificateFile      \/etc\/ssl\/certs\/apache.crt\n\tSSLCertificateKeyFile   \/etc\/ssl\/private\/private.key\n<\/pre><\/div>\n\n\n<h3 id=\"toc8\" class=\"wp-block-heading\">docker-compose.yml<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\nversion: &quot;3&quot;\nservices:\n  php-apache:\n    build: .\/PHP-Apache\n    container_name: PHP-Apache\n    ports:\n      - 80:80\n      - 443:443        \u2190 https\u306e\u30dd\u30fc\u30c8\u756a\u53f7\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3002\n    volumes:\n#      - \\\\wsl.localhost\\Ubuntu\\Development\\TestSite:\/var\/www\/html\n      - \/Users\/user_name\/Development\/aiueo\/Code:\/var\/www\/html\n  postgresql:\n    build: .\/PostgreSQL\n    container_name: PostgreSQL\n    ports:\n      - 5432:5432\n    volumes:\n#      - \\\\wsl.localhost\\Ubuntu\\Development\\DevEnvironment\\postgresql.conf:\/etc\/postgresql\/postgresql.conf\n      - \/Users\/user_name\/Development\/aiueo\/DevEnvironment\/aiueo_DevelopEnvironment\/docker\/Dockerfile\/PostgreSQL\/postgresql.conf:\/etc\/postgresql\/postgresql.conf\n    command: &#039;-c config_file=\/etc\/postgresql\/postgresql.conf&#039;\n\n<\/pre><\/div>\n\n\n<h3 id=\"toc9\" class=\"wp-block-heading\">php-apache\u30b3\u30f3\u30c6\u30ca\u306eDockerfile<\/h3>\n\n\n\n<p>\u6b21\u306e\u5185\u5bb9\u306b\u306a\u3063\u305f\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: yaml; title: ; notranslate\" title=\"\">\nFROM php:8.2.11-apache\nLABEL authors=&quot;shinke1987&quot;\n\n# Composer\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\n# Composer\u306e\u516c\u5f0f\u30da\u30fc\u30b8\u304b\u3089\u5f15\u7528\u3002\nCOPY --from=composer\/composer:latest-bin \/composer \/usr\/bin\/composer\n\n# \u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3002\nRUN apt-get update\nRUN apt-get -y install less git unzip\n\n# \u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306e\u8a2d\u5b9a\nRUN cp \/usr\/share\/zoneinfo\/Asia\/Tokyo \/etc\/localtime\n\n# pdo_pgsql\u3067\u5fc5\u8981\u3002\nRUN apt-get -y install libpq-dev\n\n# apachectl status \u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u306b\u5fc5\u8981\u3002\nRUN apt-get -y install lynx\n\n# Apache\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3002\nCOPY .\/apache2.conf \/etc\/apache2\/\nCOPY .\/000-default.conf \/etc\/apache2\/sites-available\/\nCOPY .\/default-ssl.conf \/etc\/apache2\/sites-available\/    \u2190 \u3053\u306e\u884c\u8ffd\u52a0\u3002\n\n# PHP\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3002\nCOPY .\/php.ini \/usr\/local\/etc\/php\/\n\n# TLS\/SSL\u63a5\u7d9a\u306b\u5fc5\u8981\u306a\u8a3c\u660e\u66f8\u3092\u30b3\u30d4\u30fc\u3002\nCOPY .\/cert\/apache.crt \/etc\/ssl\/certs\/    \u2190 \u3053\u306e\u884c\u8ffd\u52a0\u3002\n\n# TLS\/SSL\u63a5\u7d9a\u306b\u5fc5\u8981\u306a\u79d8\u5bc6\u9375\u3092\u30b3\u30d4\u30fc\u3002\nCOPY .\/cert\/private.key \/etc\/ssl\/private    \u2190 \u3053\u306e\u884c\u8ffd\u52a0\u3002\n\n## SSL\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u6709\u52b9\u5316\u3002\n## mod_rewrite\u3092\u6709\u52b9\u5316\u3002\uff08https:\/\/URL\/aiueo\u3078\u30a2\u30af\u30bb\u30b9\u3057\u3066404\u3068\u3057\u306a\u3044\u305f\u3081\uff09\uff0820240314\u8ffd\u8a18\uff09\nRUN a2enmod ssl rewrite           \u2190 \u3053\u306e\u884c\u8ffd\u52a0\u3002\n\n## https\u3067\u306e\u30d0\u30fc\u30c1\u30e3\u30eb\u30db\u30b9\u30c8\u6709\u52b9\u5316\u3002\nRUN a2ensite default-ssl    \u2190 \u3053\u306e\u884c\u8ffd\u52a0\u3002\n\n# Laravel\u3067\u5fc5\u8981\u306aPHP\u306e\u62e1\u5f35\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u8a2d\u5b9a\u3002\nRUN docker-php-ext-install pdo_pgsql\n\n# xDebug\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\nRUN pecl install xdebug-3.2.2\n# xDebug\u8a2d\u5b9a\u3002\nRUN docker-php-ext-enable xdebug\n# xDebug\u7528\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3002\nCOPY .\/docker-php-ext-xdebug.ini \/usr\/local\/etc\/php\/conf.d\/\n\n\n# Apache\u8d77\u52d5\u3002\nCMD &#x5B;&quot;apache2-foreground&quot;]\n<\/pre><\/div>\n\n\n<h2 id=\"toc10\" class=\"wp-block-heading\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker\n\u2514 Dockerfile\n\u3000 \u251c PHP-Apache\n\u3000 \u2502 \u251c cert\n\u3000 \u2502 \u2502 \u251c apache.crt\n\u3000 \u2502 \u2502 \u251c apache.csr\n\u3000 \u2502 \u2502 \u2514 private.key\n\u3000 \u2502 \u251c 000-default.conf\n\u3000 \u2502 \u251c apache2.conf\n\u3000 \u2502 \u251c default-ssl.conf\n\u3000 \u2502 \u251c docker-php-ext-xdebug.ini\n\u3000 \u2502 \u251c Dockerfile\n\u3000 \u2502 \u2514 php.ini\n\u3000 \u251c PostgreSQL\n\u3000 \u2502 \u251c Dockerfile\n\u3000 \u2502 \u251c pg_hba.conf\n\u3000 \u2502 \u2514 postgresql.conf\n\u3000 \u251c .env\n\u3000 \u2514 docker-compose.yml\n<\/pre><\/div>\n\n\n<h2 id=\"toc11\" class=\"wp-block-heading\">\u30b3\u30f3\u30c6\u30ca\u4f5c\u6210<\/h2>\n\n\n\n<p>\u4e0a\u8a18\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u306eDockerfile\u76f4\u4e0b\u306b\u3066\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<br>\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001docker\u306e\u30a4\u30e1\u30fc\u30b8\u307e\u3067\u524a\u9664\u3057\u3066\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# docker compose up -d\n<\/pre><\/div>\n\n\n<p>\u305d\u306e\u5f8c\u3001Web\u30d6\u30e9\u30a6\u30b6\u3067https:\/\/URL\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001\u8a3c\u660e\u66f8\u306b\u3064\u3044\u3066\u6ce8\u610f\u3055\u308c\u3066\u3082\u7d9a\u884c\u3059\u308c\u3070\u3001<br>http\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u6642\u3068\u540c\u3058\u5834\u6240\u3078\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<h2 id=\"toc12\" class=\"wp-block-heading\">\u305d\u306e\u4ed6<\/h2>\n\n\n\n<p>a2enmod\u30b3\u30de\u30f3\u30c9\u3084a2ensite\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eapache2.conf\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u305d\u306e\u5b58\u5728\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u304c\u3001<br>man\u30da\u30fc\u30b8\u306f\u30b3\u30f3\u30c6\u30ca\u5185\u306b\u5b58\u5728\u3057\u306a\u304b\u3063\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSL\/TLS\u3067\u306e\u901a\u4fe1\u306e\u305f\u3081\u306b\u5fc5\u8981\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u6e96\u5099 \u74b0\u5883 openssl v3.2.1 \u79d8\u5bc6\u9375\u3092\u4f5c\u6210 \u8a3c\u660e\u66f8\u7f72\u540d\u8981\u6c42\u3092\u4f5c\u6210\uff08\u8a3c\u660e\u66f8\u4f5c\u6210\u306e\u305f\u3081\u306b\u4f5c\u6210\uff09 \u4e0a\u8a18\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u6642\u306e\u3001\u5165\u529b\u5fc5\u9808\u9805\u76ee\u3002 \u8a3c\u660e\u66f8\u3092\u4f5c\u6210 \u6b21\u306e\u8868\u793a\u304c\u51fa\u3066\u3001a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97],"tags":[32,81],"class_list":["post-1064","post","type-post","status-publish","format-standard","hentry","category-docker","tag-apache","tag-php"],"_links":{"self":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1064"}],"version-history":[{"count":6,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1064\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/shinke1987.net\/index.php?rest_route=\/wp\/v2\/posts\/1064\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shinke1987.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}