www.mtkn.jp

Manuscripts for my personal webpage.
git clone https://git.mtkn.jp/www.mtkn.jp
Log | Files | Refs | LICENSE

relayd.html (2334B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 	<meta charset="utf-8">
      5 	<meta name="viewport" content="width=device-width,initial-scale=1">
      6 	<link rel="stylesheet" type="text/css" href="/style.css">
      7 	<link rel="icon" type="image/x-icon" href="/pics/favicon.ico">
      8 	<title>relayd、httpd、acme-client</title>
      9 </head>
     10 <body>
     11 	<header>
     12 		<a href="/">主頁</a> |
     13 		<a href="/about.html">自己紹介</a> |
     14 		<a href="/journal">日記</a> |
     15 		<a href="/farm">農業</a> |
     16 		<a href="/kitchen">台所</a> |
     17 		<a href="/computer">電算機</a> |
     18 		<a href="/poetry">詩</a> |
     19 		<a href="/books">本棚</a> |
     20 		<a href="/gallery">絵</a> |
     21 		<a href="/plant">植物</a> |
     22 		<a href="https://git.mtkn.jp">Git</a>
     23 	</header>
     24 	<main>
     25 		<article>
     26 <h1>relayd、httpd、acme-client</h1>
     27 <time>2025-07-17</time>
     28 
     29 <h2>はじめに</h2>
     30 <p>
     31 このサーバーでは<code>httpd</code>により80番ポートと443番ポートを監視してウェブサイトを運用していたが、別のソフトウェアを使ってバーチャルホストを立てたくなった。そこで、<code>httpd</code>の手前に<code>relayd</code>を挟んで、外から80番、443番ポートへの通信をサブドメインによって振り分けるようにした。</p>
     32 
     33 <figure>
     34 <figcaption>Before</figcaption>
     35 <pre>Internet -- tcp/80,443 -- httpd
     36 </pre>
     37 </figure>
     38 <figure>
     39 <figcaption>After</figcaption>
     40 <pre>Internet -- tcp/80,443 -- relayd -- tcp/8080,8443 -- httpd
     41                               └------ tcp/8081 -- other http server
     42 </pre>
     43 </figure>
     44 
     45 <h2>httpd.conf</h2>
     46 <p>
     47 <code>httpd.conf</code>は80番ポートを監視している部分はポート番号を変更するだけでいい。443番ポートの方はポート番号の変更に加え、<code>tls</code>の部分を削除する。tlsは<code>relayd</code>が行なう。</p>
     48 
     49 <h2>acme-client.conf</h2>
     50 <p>
     51 こちらは<code>full chain certificate</code>のパス<code>relayd</code>が見つけられるように変更する。
     52 </p>
     53 
     54 <h2>relayd.conf</h2>
     55 <p>
     56 80番ポートはそのまま8080番に転送する。443番ポートはtlsをかませて8443番に転送する。</p>
     57 
     58 		</article>
     59 
     60 	</main>
     61 	<footer>
     62 		<address>info(at)mtkn(dot)jp</address>
     63 		<a href="http://creativecommons.org/publicdomain/zero/1.0?ref=chooser-v1" rel="license noopener noreferrer">CC0 1.0</a>
     64 	</footer>
     65 </body>
     66 </html>