{"id":404,"date":"2024-04-29T23:41:29","date_gmt":"2024-04-29T14:41:29","guid":{"rendered":"https:\/\/txn.myds.me\/blog\/?p=404"},"modified":"2024-04-29T23:41:29","modified_gmt":"2024-04-29T14:41:29","slug":"podman-%e3%81%a7-caddy-cakephp5-%e3%82%92%e5%8b%95%e3%81%8b%e3%81%99","status":"publish","type":"post","link":"https:\/\/blog.txn.red\/?p=404","title":{"rendered":"podman \u3067 Caddy + CakePHP5 \u3092\u52d5\u304b\u3059"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/blog.txn.red\/?p=399\">\u524d\u56de<\/a>\u306e\u7d9a\u304d\u3067\u3059\u3002php-fpm \u30b3\u30f3\u30c6\u30ca\u306b CakePHP\uff15 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305f\u306e\u3067\u3044\u3088\u3044\u3088 CaddyServer \u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%25e7%259b%25ae%25e7%259a%2584%25e3%2581%25ae%25e6%25a7%258b%25e6%2588%2590\">\u76ee\u7684\u306e\u69cb\u6210<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u65e6\u3001\u4eca\u56de podman \u3067\u5efa\u3066\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u3068\u30dd\u30fc\u30c8\u306e\u69cb\u6210\u3092\u8aac\u660e\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CaddyServer \u30db\u30b9\u30c8\u30dd\u30fc\u30c8:8080 &gt;  \u30b3\u30f3\u30c6\u30ca\u30dd\u30fc\u30c8:80<\/li>\n\n\n\n<li>php-fpm  \u30db\u30b9\u30c8\u30dd\u30fc\u30c8: &#8211; >  \u30b3\u30f3\u30c6\u30ca\u30dd\u30fc\u30c8:9000<\/li>\n\n\n\n<li>MariaDB \u30db\u30b9\u30c8\u30dd\u30fc\u30c8:3306 &gt;  \u30b3\u30f3\u30c6\u30ca\u30dd\u30fc\u30c8:3306<\/li>\n\n\n\n<li>.\/html \u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u308a CaddyServer \u3068 php-fpm \u304b\u3089\u305d\u308c\u305e\u308c\u30ea\u30f3\u30af\u3059\u308b<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%25e6%2589%258b%25e9%25a0%2586\">\u624b\u9806<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"caddy-%25e3%2582%25b3%25e3%2583%25b3%25e3%2583%2586%25e3%2583%258a\">Caddy \u30b3\u30f3\u30c6\u30ca<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Caddyfile \u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 \/ \u3067 CakePHP \u3092\u30db\u30b9\u30c8\u3059\u308b\u5834\u5408\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>$ mkdir conf\n$ vi conf\/Caddyfile\n:80 {\n\t# Set this path to your site&#39;s directory.\n\troot * \/usr\/share\/caddy\/app\/webroot\n\tencode gzip\n\n\t# Enable the static file server.\n\tfile_server\n\n\t# Another common task is to set up a reverse proxy:\n\tphp_fastcgi localhost:9000\n\n\t# log\n}<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u521d \/app \u306a\u3069\u306e\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u30db\u30b9\u30c8\u3057\u3088\u3046\u3068\u3057\u307e\u3057\u305f\u304c\u3001\u53c2\u8003\u30ea\u30f3\u30af\u306b\u3088\u308b\u3068\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u30db\u30b9\u30c8\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u3089\u3057\u3044\u306e\u3067\u305d\u3046\u305d\u3046\u306b\u3042\u304d\u3089\u3081\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>\uff04 podman run --name caddy -p 8080:80\/tcp \\\n  -v .\/conf\/Caddyfile:\/etc\/caddy\/Caddyfile \\\n  -v .\/html:\/usr\/share\/caddy \\\n  caddy:latest<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u3053\u307e\u3067\u3067 MariaDB\u3001Caddy\u3001\uff50\uff48\uff50\u2212\uff46\uff50\uff4d \u306e\uff13\u3064\u306e\u30b3\u30f3\u30c6\u30ca\u304c\u63c3\u3044\u307e\u3057\u305f\u3002podman \u7684\u306b\u306f kubernetes \u306e yaml \u30d5\u30a1\u30a4\u30eb\u306b\u3057\u308d\u3063\u3066\u3053\u3068\u306a\u306e\u3067\u7c21\u5358\u306b\u751f\u6210\u3059\u308b\u305f\u3081\u306b\u3001podman-desktop \u3067 pod \u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u305d\u306e\u307e\u307e pod \u3092 yaml \u306b\u5410\u304d\u51fa\u3057\u305f\u3082\u306e\u3092\u5c11\u3057\u4fee\u6b63\u3057\u307e\u3059\u3002\u4fee\u6b63\u3057\u305f\u7d50\u679c\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code># Save the output of this file and use kubectl create -f to import\n# it into Kubernetes.\n#\n# Created with podman-3.4.4\napiVersion: v1\nkind: Pod\nmetadata:\n  creationTimestamp: &quot;2024-04-29T05:49:28Z&quot;\n  labels:\n    app: caddy-pod\n  name: caddy-pod\nspec:\n  containers:\n  - args:\n    - mariadbd\n    image: docker.io\/library\/mariadb:11.3\n    name: maria\n    ports:\n    - containerPort: 3306\n      hostPort: 3306\n    - containerPort: 80\n      hostPort: 8080\n    resources: {}\n    securityContext:\n      capabilities:\n        drop:\n        - CAP_MKNOD\n        - CAP_NET_RAW\n        - CAP_AUDIT_WRITE\n    volumeMounts:\n    - mountPath: \/var\/lib\/mysql\n      name: maria-data\n  - image: docker.io\/library\/caddy:latest\n    name: caddy\n    resources: {}\n    securityContext:\n      capabilities:\n        drop:\n        - CAP_MKNOD\n        - CAP_NET_RAW\n        - CAP_AUDIT_WRITE\n    volumeMounts:\n    - mountPath: \/etc\/caddy\/Caddyfile\n      name: caddy-file\n    - mountPath: \/usr\/share\/caddy\n      name: html-caddy\n  - args:\n    - php-fpm\n    image: localhost\/my-php:latest\n    name: php\n    resources: {}\n    securityContext:\n      capabilities:\n        drop:\n        - CAP_MKNOD\n        - CAP_NET_RAW\n        - CAP_AUDIT_WRITE\n    volumeMounts:\n    - mountPath: \/usr\/share\/caddy\n      name: html-fpm\n    - mountPath: \/usr\/local\/etc\/php\/php-fpm.conf\n      name: fpm-conf\n    - mountPath: \/usr\/local\/etc\/php\/php.ini\n      name: php-ini\n  restartPolicy: Never\n  volumes:\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/maria\/data\n      type: Directory\n    name: maria-data\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/conf\/Caddyfile\n      type: File\n    name: caddy-file\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/html\n      type: Directory\n    name: html-caddy\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/html\n      type: Directory\n    name: html-fpm\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/php-fpm\/php\/php-fpm.conf\n      type: File\n    name: fpm-conf\n  - hostPath:\n      path: \/opt\/ws\/podman-caddy\/php-fpm\/php\/php.ini-development\n      type: File\n    name: php-ini\nstatus: {}\n<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e yaml \u30d5\u30a1\u30a4\u30eb\u3067 pod \u3092\u8d77\u52d5\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"caddy-pod.yaml\"><code>$ podman play kube caddy-pod.yaml<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">localhost:8080 \u306b\u30d6\u30e9\u30a6\u30b6\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/blog.txn.red\/wp-content\/uploads\/2024\/04\/caddy-cake-1024x706.png\" alt=\"\" class=\"wp-image-409\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">MariaDB \u3068\u306e\u63a5\u7d9a\u304c\u307e\u3060\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u52d5\u4f5c\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u5230\u9054\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%25e5%258f%2582%25e8%2580%2583\">\u53c2\u8003<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/caddy.community\/t\/the-subfolder-problem-or-why-cant-i-reverse-proxy-my-app-into-a-subfolder\/8575\">The &#8220;subfolder problem&#8221;, OR, &#8220;why can&#8217;t I reverse proxy my app into a subfolder?&#8221; &#8211; Wiki &#8211; Caddy Community<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u7d9a\u304d\u3067\u3059\u3002php-fpm \u30b3\u30f3\u30c6\u30ca\u306b CakePHP\uff15 \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305f\u306e\u3067\u3044\u3088\u3044\u3088 CaddyServer \u3092\u5165\u308c\u307e\u3059\u3002 \u76ee\u7684\u306e\u69cb\u6210 \u4e00\u65e6\u3001\u4eca\u56de podman \u3067\u5efa\u3066\u3088\u3046\u3068\u3057\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u3068\u30dd\u30fc\u30c8\u306e\u69cb\u6210\u3092\u8aac\u660e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":1,"footnotes":""},"categories":[5],"tags":[15,16],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-it","tag-cakephp","tag-podman"],"_links":{"self":[{"href":"https:\/\/blog.txn.red\/index.php?rest_route=\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.txn.red\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.txn.red\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.txn.red\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.txn.red\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=404"}],"version-history":[{"count":0,"href":"https:\/\/blog.txn.red\/index.php?rest_route=\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.txn.red\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.txn.red\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.txn.red\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}