<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nitit Chakritkon on Medium]]></title>
        <description><![CDATA[Stories by Nitit Chakritkon on Medium]]></description>
        <link>https://medium.com/@codeself?source=rss-470d43a8395------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Y78nf0FAC_iFuXO1EK8yFQ.jpeg</url>
            <title>Stories by Nitit Chakritkon on Medium</title>
            <link>https://medium.com/@codeself?source=rss-470d43a8395------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 19:15:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@codeself/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to setup NGINX trust client certificate before Reverse-Proxy]]></title>
            <link>https://medium.com/@codeself/how-to-setup-nginx-trust-client-certificate-before-reverse-proxy-567747bf5735?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/567747bf5735</guid>
            <category><![CDATA[reverse-proxy]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[client-certificate]]></category>
            <category><![CDATA[nginx-configuration]]></category>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 03:18:40 GMT</pubDate>
            <atom:updated>2024-07-21T03:25:56.614Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBknLd_M9tI2LlwZSMBTjw.png" /></figure><pre>server {<br>  listen 443 ssl;<br>  server_name yourdomain.com;<br><br>  location /healthcheck/ {<br>    add_header Content-Type text/html;<br>    return 200 &#39;OK&#39;;<br>  }<br><br>  # This line is enabled trust cert <br>  # Cert file for client trust cert only<br>  # You can use cert difference Domain SSL cert<br>  ssl_verify_client optional;<br>  ssl_client_certificate /etc/nginx/conf.d/ssl/your-cert.crt;<br><br><br>  location / {    <br>    # You can allow some location path using trust cert<br>    if ($ssl_client_verify != SUCCESS) {<br>        return 400;<br>    }    <br>    proxy_set_header VERIFIED $ssl_client_verify;<br>    proxy_set_header DN $ssl_client_s_dn;<br><br>    proxy_pass http://127.0.0.1:3000/;   <br><br>    proxy_set_header X-Real-IP $remote_addr;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>    proxy_set_header X-Forwarded-Proto $scheme;<br>  }<br><br>  # Custom Error<br>  error_page 400 495 496 497 /400.json;<br>  location /400.json {    <br>    return 400 &#39;{&quot;error&quot;: {&quot;status_code&quot;: 400,&quot;status&quot;: &quot;The ssl certificate error&quot;}}&#39;;<br>  }<br><br><br>  ssl_certificate /etc/nginx/conf.d/ssl/your_domain_com.crt;<br>  ssl_certificate_key /etc/nginx/conf.d/ssl/your_domain.key;<br>  ssl_protocols TLSv1.2;<br>  ssl_prefer_server_ciphers on;<br>  ssl_ciphers HIGH:!aNULL:!MD5;<br>}</pre><p>You can generate self-cert and signed cert for sent to client with command below.</p><pre>### Generate cert ( This cert using in nginx &#39;ssl_client_certificate&#39; )<br>Generate a Private Key:<br>openssl req \<br> -x509 \<br> -newkey rsa:4096 \<br> -keyout ./server.key \<br> -out ./server.crt \<br> -nodes \<br> -days 365 \<br> -subj &quot;/CN=localhost/O=Certificate\ Demo&quot;<br><br>### Generate for Client<br>openssl req \<br> -newkey rsa:4096 \<br> -keyout ./client.key \<br> -out ./client.csr \<br> -nodes \<br> -days 365 \<br> -subj &quot;/CN=Client Test&quot;<br><br># sign client cert with CA Cert<br>openssl x509 \<br> -req \<br> -in ./client.csr \<br> -CA ./server.crt \<br> -CAkey ./server.key \<br> -out ./client.crt \<br> -set_serial 01 \<br> -days 365</pre><p>Test with curl</p><pre>curl --key client.key \<br>     --cert client.crt \<br>     https://your-domain.com</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=567747bf5735" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NodeJS Restful API Secure with Trust Certificate Request]]></title>
            <link>https://medium.com/@codeself/nodejs-restful-api-secure-with-trust-certificate-request-c85d4d5d0a35?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/c85d4d5d0a35</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[self-certification]]></category>
            <category><![CDATA[client-certificate]]></category>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Mon, 01 Jul 2024 04:26:41 GMT</pubDate>
            <atom:updated>2024-07-01T04:26:41.531Z</atom:updated>
            <content:encoded><![CDATA[<p>Step by Step</p><h3>1. Generate Self certificate</h3><pre># Generate a Private Key:<br>openssl genrsa -out private.key 2048 <br><br><br># Generate a Certificate Signing Request (CSR):<br>openssl req -new -key private.key -out certificate.csr<br><br># Self-Sign the Certificate:<br>openssl x509 -req -days 365 -in certificate.csr -signkey private.key -out certificate.crt</pre><h3>2. Create NodeJS Project</h3><pre>// server.js<br>const https = require(&#39;https&#39;);<br>const fs = require(&#39;fs&#39;);<br><br>const options = {<br>  key:  fs.readFileSync(&#39;./certs/private.key&#39;),    // Path to your server&#39;s private key<br>  cert: fs.readFileSync(&#39;./certs/certificate.crt&#39;),    // Path to your server&#39;s certificate<br>  ca:   fs.readFileSync(&#39;./certs/certificate.crt&#39;),        // Path to the CA certificate used to sign both certs<br>  requestCert: true, // Request client certificate<br>  rejectUnauthorized: false // Reject unauthorized clients<br>};<br><br>var server = https.createServer(options, function (req, res) {<br>   var ip = req.headers[&#39;x-forwarded-for&#39;] ||<br>            req.socket.remoteAddress ||<br>            null;<br><br>   if (req.client.authorized) {<br>       res.writeHead(200, {&quot;Content-Type&quot;:&quot;application/json&quot;});<br>       res.end(&#39;{&quot;status&quot;:&quot;approved&quot;}&#39;);<br>       console.log(&quot;Approved Client &quot;, ip);<br>   } else {<br>       console.log(&quot;res.connection.authroizationError:  &quot; + res.connection.authorizationError);<br>       res.writeHead(403, {&quot;Content-Type&quot;:&quot;application/json&quot;});<br>       res.end(&#39;{&quot;status&quot;:&quot;denied&quot;}&#39;);<br>       console.log(&quot;Denied Client &quot;, ip);<br>   }<br>});<br><br>server.listen(3000, () =&gt; {<br>  console.log(&#39;Secure server listening on port 3000&#39;);<br>});</pre><pre>// client.js<br>const https = require(&#39;https&#39;);<br>const fs = require(&#39;fs&#39;);<br><br>const options = {<br>   key:  fs.readFileSync(&#39;./client-certs-valid/client.key&#39;),    // Path to your client&#39;s private key<br>   cert: fs.readFileSync(&#39;./client-certs-valid/client.crt&#39;),    // Path to your client&#39;s certificate<br>   ca:   fs.readFileSync(&#39;./client-certs-valid/client.crt&#39;),    // Path to the CA certificate <br>   rejectUnauthorized: false<br>};<br><br>const req = https.request(&#39;https://localhost:3000&#39;, options, (res) =&gt; {<br>  let data = &#39;&#39;;<br>  res.on(&#39;data&#39;, (chunk) =&gt; { data += chunk; });<br>  res.on(&#39;end&#39;, () =&gt; { console.log(&#39;Response:&#39;, data); });<br>});<br><br>req.on(&#39;error&#39;, (err) =&gt; { console.error(&#39;Error:&#39;, err); });<br>req.end(); </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lN-_gSQtGRYqTFum09qZbw.png" /></figure><h3>Test</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*pXr7IYuA42uJ_sZZz9Kfpw.png" /><figcaption>Valid Trust Certificate</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*35uIO1yBTmyQzApr1IuHMw.png" /><figcaption>Invalid Certificate</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c85d4d5d0a35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NGINX lost upstram from AWS ELB ip changed]]></title>
            <link>https://medium.com/@codeself/nginx-lost-upstram-from-aws-elb-ip-changed-a825aab69887?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/a825aab69887</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[aws-load-balancer]]></category>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 10:05:49 GMT</pubDate>
            <atom:updated>2023-04-05T10:05:49.726Z</atom:updated>
            <content:encoded><![CDATA[<p>My Nginx use proxy_pass to AWS ELB multiple AZ.<br>Sometime cannot access url. Becuase server cannot solve ip ELB.</p><p>Found : If use upstram config nginx get ELB ip address once time at service started.</p><pre># Before<br>upstream my-server {<br>    server my-ecs.test.com:443 max_fails=0;<br>}<br><br>server {<br>   location /api/ {<br>        client_max_body_size 20M;<br>        proxy_pass https://my-server/;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_connect_timeout 360s;<br>        proxy_send_timeout   360s;<br>        proxy_read_timeout   360s;<br>   }<br>}</pre><p>Solve ! change config remove upstram and use variable set url to ELB.<br>(Becuase use variable Nginx get new IP every request)</p><pre># After : Solve with use set Variable<br>server {<br>   location /api/ {<br>        client_max_body_size 20M;<br>        set $myserver &quot;my-ecs.test.com:443&quot;;<br>        proxy_pass https://$myserver;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_connect_timeout 360s;<br>        proxy_send_timeout   360s;<br>        proxy_read_timeout   360s;<br>   }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a825aab69887" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Bash : expect -c added timeout]]></title>
            <link>https://medium.com/@codeself/linux-bash-expect-c-added-timeout-982af71fb039?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/982af71fb039</guid>
            <category><![CDATA[linux-commands]]></category>
            <category><![CDATA[linux-bash]]></category>
            <category><![CDATA[bash-sftp]]></category>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 09:38:45 GMT</pubDate>
            <atom:updated>2023-04-05T09:50:13.489Z</atom:updated>
            <content:encoded><![CDATA[<h3>Linux Bash SFTP : expect -c added timeout</h3><p>Issue : SFTP file not complete with expect command<br>becuase default timeout 10 sec</p><p>Solve! with add option expect -timeout <br>after line “mput” command</p><pre>#!/bin/bash<br>HOST=$1<br>USERNAME=$2<br>PASSWORD=$3<br>PATH=$4<br>LOCALPATH=$5<br>FILENAME=$6<br>TIMEOUT=600<br><br>VAR=$(expect -c &quot;<br>set timeout 600<br>spawn sftp -o ConnectTimeout=$TIMEOUT -o  ServerAliveInterval=300 -o ServerAliveCountMax=5 -o BatchMode=no -o StrictHostKeyChecking=no $USERNAME@$HOST<br>expect -nocase \&quot;*Are you sure you want to continue connecting*\&quot; { send \&quot;yes\r\&quot;; }<br>expect -nocase \&quot;*password:\&quot; { send \&quot;$PASSWORD\r\&quot;; }<br>expect -nocase \&quot;sftp&gt;\&quot; { send \&quot;cd $PATH\r\&quot;; }<br>expect -nocase \&quot;sftp&gt;\&quot; { send \&quot;lcd $LOCALPATH\r\&quot;; }<br>expect -nocase \&quot;sftp&gt;\&quot; { send \&quot;mput $FILENAME\r\&quot;; }<br>expect -timeout $TIMEOUT -nocase \&quot;sftp&gt;\&quot; { send \&quot;bye\r\&quot;; }<br>&quot;)<br><br>echo &quot;===============&quot;<br>echo &quot;$VAR&quot;<br><br>rm &quot;${LOCALPATH}/${FILENAME}&quot;</pre><p>For example added timeout 600 sec</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=982af71fb039" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache+PHP Enable GZIP for reduce JSON response size]]></title>
            <link>https://medium.com/@codeself/apache-php-enable-gzip-for-reduce-json-response-size-9a3e96e32dc3?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a3e96e32dc3</guid>
            <category><![CDATA[apache-php-gzip]]></category>
            <category><![CDATA[slim-gzip]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[php-gzip]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Sun, 14 Mar 2021 04:43:27 GMT</pubDate>
            <atom:updated>2021-03-14T04:43:27.259Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This example use PHP Slim Framework <br>Test fetch product information from database 4,000 sku for data table.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*ZwfMP88Fc4ZxWCyXSf-Ujg.png" /></figure><h3>Step 1. Go to /apache/conf/httpd.conf</h3><pre>#Enable Module<br>LoadModule deflate_module modules/mod_deflate.so<br>LoadModule filter_module modules/mod_filter.so</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*mfVFOjQ3WXDGEEFSuvtHrA.png" /></figure><h3>Step 2. Go to .htaccess file</h3><pre>&lt;IfModule mod_deflate.c&gt;<br>   SetOutputFilter DEFLATE<br>   &lt;IfModule mod_filter.c&gt;<br>       AddOutputFilterByType DEFLATE application/json<br>   &lt;/IfModule&gt;<br>&lt;/IfModule&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*CehDcQOEHFSeu88HQfFruA.png" /></figure><h3>Step 3. Restart Apache</h3><h3>Finish and View Result</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*ZwfMP88Fc4ZxWCyXSf-Ujg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a3e96e32dc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ติดตั้ง SSL : บน Windows & XAMPP & Let’s Encrypt]]></title>
            <link>https://medium.com/@codeself/%E0%B8%95%E0%B8%B4%E0%B8%94%E0%B8%95%E0%B8%B1%E0%B9%89%E0%B8%87-ssl-%E0%B8%9A%E0%B8%99-windows-xampp-lets-encrypt-663bc342870?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/663bc342870</guid>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 07:56:13 GMT</pubDate>
            <atom:updated>2020-03-02T07:59:54.989Z</atom:updated>
            <content:encoded><![CDATA[<h3>ติดตั้ง SSL : บน Windows &amp; XAMPP &amp; Let’s Encrypt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xecqI8KDNBVfwwRd4LAz-w.png" /></figure><p>ก่อนอื่นต้องขอข้ามเรื่องการติดตั้ง XAMPP เลยนะครับ</p><h4><em>certificate ของ Let’s Encrypt นั้นจะมีอายุ 90 วัน <br>ดังนั้นเราต้อง generate ใหม่ก่อนที่จะหมดอายุ</em></h4><h4><em>เรามาเริ่มทำการติดตั้ง ssl กันเลย</em></h4><blockquote><strong><em>1. Download WIN-ACME</em></strong><br><a href="https://www.win-acme.com/">https://www.win-acme.com/</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*vXYUHFAlsKR1EWVFP6sBTQ.png" /><figcaption>เลือกเมนู Download &gt; 2.1.4 recommended</figcaption></figure><blockquote><strong><em>2. Unzip File </em></strong><em>โดยวางไว้ที่ใดก็ได้ จะได้รายการไฟล์ดังนี้<br>จากตัวอย่างไฟล์จะอยู่ที่ C:\win-acme</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/1*oErRiAbJp8hgdRWK8wmcHg.png" /><figcaption>จากตัวอย่างไฟล์จะอยู่ที่ C:\win-acme</figcaption></figure><blockquote><strong><em>3. เปิด Command Prompt และเข้าไปยัง Path ที่วางไฟล์ และพิมพ์คำสั่งดังนี้</em></strong></blockquote><pre>C:\win-acme&gt; wacs.exe --target manual <br>--host abc.com,www.abc.com <br>--validation filesystem <br>--webroot &quot;C:\xampp\htdocs\abc.com\htdocs&quot; <br>--store pemfiles --pemfilespath C:\xampp\apache\conf\ssl.crt</pre><p><em>** ต้องเป็นบรรทัดเดียวกัน ตัวอย่างแยกบรรทัดเพื่อให้เข้าใจได้ง่าย</em></p><pre>--target manual<br>  คือ wacs.exe ถ้ารันปกติจะให้ Service IIS ดังนั้นเราต้องใช้ Manual</pre><pre>--host abc.com,www.abc.com<br>  ต้องระบุชื่อ Domain โดยเราต้องระบุทั้ง www , non-www</pre><pre>--validation filesystem<br>  <br>--webroot &quot;C:\xampp\htdocs\abc.com\htdocs&quot;<br>  กำหนดไปยัง path ที่วางไฟล์เว็บ เนื่องจากจะมีการวางไฟล์ .well-known <br>  เพื่อยืนยันตัวตนเว็บไซด์</pre><pre>--store pemfiles --pemfilespath C:\xampp\apache\conf\ssl.crt<br>  กำหนด folder วางไฟล์ cert (เอาไว้ไหนก็ได้ที่ไม่ใช่ที่เก็บไฟล์เว็บ)</pre><blockquote><strong><em>4. เมื่อดำเนินการเสร็จแล้วจะได้ไฟล์ 3 ไฟล์ ดังรูป</em></strong><em><br>จากตัวอย่างจะอยู่ที่ folder : </em>C:\xampp\apache\conf\ssl.crt</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/1*ft0EFH4IGZic6PS23vE-vQ.png" /></figure><blockquote><strong><em>5. ต้องทำการแก้ไขไฟล์ “ </em></strong><em>httpd-vhosts.conf </em><strong><em>”</em></strong><br><em>จากตัวอย่างไฟล์จะอยู่ที่ </em>C:\xampp\apache\conf\extra\httpd-vhosts.conf<br><em>เพิ่มในส่วนของ &lt;VirtualHost _default_:443&gt; ตามตัวอย่าง<br>โดยต้องระบุ SSLCertificate ไปยัง path ที่เราเก็บไฟล์ .pem<br>และข้อมูลอื่นๆ ให้ตรงตามโปรเจคของตนเอง</em></blockquote><pre>&lt;VirtualHost _default_:80&gt;<br> DocumentRoot &quot;C:/xampp/htdocs/abc.com/htdocs&quot;<br> ServerName abc.com<br> ServerAlias abc.com</pre><pre> # BEGIN: Enable HTTP to HTTPS redirection<br> RewriteEngine On<br> RewriteCond %{HTTPS} !=on<br> RewriteCond %{HTTP_HOST} !^localhost<br> RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+$<br> RewriteCond %{REQUEST_URI} !^/\.well-known<br> RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]<br> # END: Enable HTTP to HTTPS redirection</pre><pre> &lt;Directory &quot;C:/xampp/htdocs/abc.com/htdocs&quot;&gt;<br>    Options -Indexes +FollowSymLinks<br> &lt;/Directory&gt;<br>&lt;/VirtualHost&gt;</pre><pre>&lt;VirtualHost _default_:443&gt;<br> DocumentRoot &quot;C:/xampp/htdocs/abc.com/htdocs&quot;<br> ServerName abc.com<br> ServerAlias abc.com<br>    <br> SSLEngine on<br> SSLCertificateFile &quot;C:\xampp\apache\conf\ssl.crt\abc.com-crt.pem&quot;<br> SSLCertificateKeyFile &quot;C:\xampp\apache\conf\ssl.crt\abc.com-key.pem&quot;<br> SSLCertificateChainFile &quot;C:\xampp\apache\conf\ssl.crt\abc.com-chain.pem&quot;    <br>  <br> &lt;Directory &quot;C:/xampp/htdocs/abc.com/htdocs&quot;&gt;<br>   Options -Indexes +FollowSymLinks<br>   AllowOverride None<br>   Order allow,deny<br>   Allow from all<br> &lt;/Directory&gt;<br>&lt;/VirtualHost&gt;</pre><blockquote><strong><em>6. จากนั้น Restart Apache</em></strong></blockquote><ul><li>** ตัวอย่างทั้งหมด ใช้ abc.com หากนำไปใช้กรุณาเปลี่ยน Domain</li></ul><h4>การตั้ง JOB Auto Re-new Certificate</h4><ol><li><strong>ให้ทำการสร้างไฟล์ xxxxx.bat </strong><br>โดยนำ Command ที่เราใช้ในการติดต้อง SSL ตัวอย่าง ดังนี้</li></ol><pre>C:\win-acme\wacs.exe --target manual --host abc.com,www.abc.com --validation filesystem --webroot &quot;C:\xampp\htdocs\abc.com\htdocs&quot; --store pemfiles --pemfilespath C:\xampp\apache\conf\ssl.crt</pre><pre>C:\xampp\apache\bin\httpd.exe -k restart</pre><p><strong>2. Save ไฟล์นามสกุล .bat ไว้ที่ใดก็ได้</strong></p><p><strong>3. จากนั้น ให้ใช้ Windows Task Scheduler ตั้ง JOB </strong><br> โดยให้ JOB รัน เดือนละครั้งเพื่อป้องกันการขอ Certificate ไม่ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*SnC37CJgyy0-JhdUk67d5w.png" /></figure><p>จบ สวัสดี</p><p>เดี๋ยวไว้มาต่อกับ เนื้อหาติดตั้ง Let’Encrypt บน Ubuntu ครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=663bc342870" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[วิธีทำ Google Form ให้ส่งเมลตอบกลับอัตโนมัติ ด้วย Google Script]]></title>
            <link>https://medium.com/@codeself/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B8%97%E0%B8%B3-google-form-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%AA%E0%B9%88%E0%B8%87%E0%B9%80%E0%B8%A1%E0%B8%A5%E0%B8%95%E0%B8%AD%E0%B8%9A%E0%B8%81%E0%B8%A5%E0%B8%B1%E0%B8%9A%E0%B8%AD%E0%B8%B1%E0%B8%95%E0%B9%82%E0%B8%99%E0%B8%A1%E0%B8%B1%E0%B8%95%E0%B8%B4-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-google-script-55f9dfc56ef2?source=rss-470d43a8395------2</link>
            <guid isPermaLink="false">https://medium.com/p/55f9dfc56ef2</guid>
            <dc:creator><![CDATA[Nitit Chakritkon]]></dc:creator>
            <pubDate>Thu, 04 Jul 2019 10:26:07 GMT</pubDate>
            <atom:updated>2020-03-11T15:18:34.284Z</atom:updated>
            <content:encoded><![CDATA[<p>#GoogleForm #GoogleScript #EmailResponse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kgur1VY4DehUcFlxrdQjA.jpeg" /></figure><blockquote><em>ขั้นแรกให้เราสร้างฟอร์มโดยมีช่อง อีเมล เพื่อรับค่าที่ต้องการให้ตอบกลับ</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0us6xplIHSOzvT4D2XrlA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkFteckYIM-ez-WXEcfO-w.jpeg" /></figure><blockquote><em>จากนั้นให้คลิกที่เมนู​ “การตอบกลับ” และคลิกที่ไอคอน “Sheet” เพื่อเข้าไปดูผลลัพธ์ขอแบบฟอร์ม</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NC3J9ucL8VknfUPMI1yYbw.jpeg" /><figcaption>ตัวอย่างข้อมูลเมื่อมีการกรอกเข้ามา</figcaption></figure><blockquote><em>จากนั้นให้ดูข้อมูลในตาราง ว่าอีเมลอยู่ที่ Column ใด</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*9o879X-0Mbv47CD9NUV0JA.png" /></figure><blockquote><em>ต่อมาจะเป็นการเขียน Script เพื่อส่งเมล ให้ไปยังเมนู “เครื่องมือ” และเลือก “โปรแกรมแก้ไขสคริปต์”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q2VZrQM3LHYETziSUe_b5w.png" /><figcaption>ตรงตัวแปร full_name และ emailAddress เลือกให้ตรง column ของท่าน</figcaption></figure><pre>function sendEmails() {<br> var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();<br> var lastRow = sheet.getLastRow();<br> <br> var full_name = sheet.getRange(&#39;D&#39;+lastRow).getValue();<br> var emailAddress = sheet.getRange(&#39;C&#39;+lastRow).getValue();<br> <br> var subject = &quot;ขอยืนยันการลงทะเบียนของท่าน&quot;;<br> var html = &quot;เรียน คุณ &quot;+full_name;<br> html+= &quot;&lt;br /&gt;ขอยืนยันการลงทะเบียนของท่าน &quot;;<br> html+= &quot;&lt;br /&gt;ในการเข้าร่วม &#39;กิจกรรมสัมมนา &quot;;<br> html+= &quot;&lt;br /&gt;ขอบคุณค่ะ&quot;;<br> html+= &quot;&lt;br /&gt;** ระบบแจ้งเตือนอัตโนมัติ กรุณาอย่า reply กลับ&quot;;</pre><pre> // กรณีต้องการใส่รูป ให้ใช้บรรทัดด้านล่างนี้ โดยแก้ลิ้งรูปที่ src=&quot;&quot;<br> html+= &#39;&lt;br /&gt;&lt;img src=&quot;<strong>https://www.../example.png</strong>&quot; /&gt;&#39;;</pre><pre> MailApp.sendEmail({<br>   to: emailAddress,<br>    // cc: &#39;<a href="/service/mailto:xxxxx@gmail.com">xxxxx@gmail.com</a>&#39;, <br>    subject: subject,<br>    htmlBody: html <br> });<br> <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*WjiLSGjWf1lUFT05TucWXw.jpeg" /></figure><blockquote><em>จากนั้นกด Save และคลิกไอคอน นาฬิกา</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R-HewX8Poh1ts256RH-3nw.jpeg" /><figcaption>ระบบจะนำเข้ามายัง G Suite Developer</figcaption></figure><blockquote><em>คลิก “+ เพิ่มทริกเกอร์” </em><br>** ระบบจะเด้งให้ เราอนุญาติโปรแกรม แนะนำให้เปิดด้วย Google Chrome **</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*Xciq4f2FydxB7O0DJCG1TA.jpeg" /></figure><blockquote><em>จากนั้นกำหนดค่าตามรูป เลือกเหตุการณ์เป็น “เมื่อส่งฟอร์ม” และ บันทึก</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRZbnu0tz6Ki8YxoSe40mA.jpeg" /></figure><blockquote><strong><em>ทดสอบการกรอกข้อมูล ระบบจะส่งอีเมลทันที</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55f9dfc56ef2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>