tag:blogger.com,1999:blog-80455169342713748572024-03-13T11:43:12.649+09:00POSTOROWebで見つけた気になるものをメモしたり、それにコメントしたりするブログ。adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.comBlogger1642125tag:blogger.com,1999:blog-8045516934271374857.post-9648763325798112172023-10-22T11:43:00.003+09:002023-10-22T11:43:46.220+09:00Amazon Linux 2023 に Let's Encrypt をインストール&自動更新<p><a href="https://softwarenote.info/p3954/" target="_blank">Amazon Linux 2023 に Let’s Encrypt をインストールする</a></p><p>Amazon Linux 2023 って、cron 入ってないんだ..。</p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-66941378730105154592023-10-07T20:50:00.006+09:002023-10-07T20:51:31.265+09:00PHPで/tmpディレクトリへのアクセスがエラー<p><a href="https://www.softel.co.jp/blogs/tech/archives/2892" target="_blank">phpから /tmp にファイルが書き込めない </a></p><p>CentOS7以降では、(systemd で動いている)PHPからの/tmpディレクトリへのアクセスが、/tmp/systemd-private-xxxx-php-fpm.service-xxxx/ のようなディレクトリへのアクセスになるようになったらしい。</p><p>なので /tmp にアクセスしているつもりが、実際には上記のディレクトリにアクセスしていた。</p><p>このディレクトリの中身は、php-fpm を restart すると消えてしまう。</p><p>手元の環境は Amazon Linux 2023 だが、同じ状況だった。</p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-17644881970033834122023-08-20T11:07:00.000+09:002023-08-20T11:07:10.023+09:00PHP8では set_error_handler で登録する関数の5番目の引数は無くなった。<p>PHP8では set_error_handler で登録する関数の5番目の引数は無くなった。</p><p><a href="https://pointsandlines.jp/server-side/php/set_error_handler-php8-args" target="_blank">PHP 8系〜 set_error_handler関数の引数</a><br /></p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-34676701356619018812023-08-20T11:04:00.005+09:002023-08-20T11:04:49.075+09:00PHP8 で php.ini の変更が反映されないのは<p> Webサーバだけでなく、php-fpm の再起動も必要。</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">sudo systemctl restart php-fpm</p></blockquote><p> </p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-77214857433903306102023-08-20T11:02:00.004+09:002023-08-20T11:02:58.913+09:00PHP8でPEAR形式の__autoload<p> PHP8 で __autoload は無くなった。</p><p>代わりに spl_autoload_register で登録する。</p><p><br /></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p> spl_autoload_register(function($className) {</p><p><span style="white-space: normal;"><span style="white-space: pre;"> </span>if (strpos($className, '.') !== false) {</span></p><p><span style="white-space: normal;"><span style="white-space: pre;"> </span>throw new Exception('不正なclass名をautoloadしようとしました');</span></p><p><span style="white-space: normal;"><span style="white-space: pre;"> </span>}</span></p><p><span style="white-space: normal;"><span style="white-space: pre;"> </span>require(strtr($className, '_', '/') . '.php');</span></p><p>});</p></blockquote><p><br /></p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-56706019109594392202023-08-20T11:00:00.001+09:002023-08-20T11:00:17.650+09:00Amazon Linux 2023 で MySQL5<p>普通に yum で入れようとするとmariadb になる。</p><p><a href="https://zenn.dev/yohane/scraps/304c828a8f30f3" target="_blank">Amazon Linux 2023にMysql5.7のClientをインストールする</a></p><p><a href="https://qiita.com/RyochanUedasan/items/9a49309019475536d22a" target="_blank">mysql5.7でパスワードを変更する</a><br /></p>adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-11855672092736209002017-06-10T06:22:00.001+09:002017-06-10T06:22:46.816+09:00Laravelで DBの登録・参照・編集・削除をするページを作るサンプル<br />
<a href="http://qiita.com/sutara79/items/cd4371b246b44a2cf87f">Laravel5.4: usersのCRUD機能を実装する - Qiita</a><br />
<br />
formまわりはもう少し調査する。<br />
<br />
<ul>
<li>新規で入力エラーになった場合の入力値の再表示(old(...)だったかな?)</li>
<li>同じく更新の場合は?</li>
</ul>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-65613500693713167882017-06-08T05:51:00.001+09:002017-06-08T05:51:06.198+09:00RLoginでキーの長押しで連続入力をする設定<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">SSHクライアントのRLoginで、新規インストールしたら(過去の設定をインポートしたから?)、キーボードのキーを押し続けても1回分しかキー入力がされなくなったので、押し続けている間入力が繰り返されるようにする設定のメモ。</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br /></div>
<span id="docs-internal-guid-a2d99086-8453-2770-b4df-6927a3b44242"></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">表示 → オプション設定 → ターミナル → 「?8 キーリピートを有効」にチェックを付ける</span></div>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-51653596725004344202017-05-28T06:42:00.000+09:002017-05-28T06:42:09.566+09:00Amazon EC2 nanoインスタンスでMySQL5.6が起動しないインストールはできたが起動でFailed。MySQL5.5でもダメ。<br />
調べてみると、メモリ不足らしい。Swapを足せばよいのだが、今回は面倒。<br />
<br />
もっと調べてみたらこんな記事が。<br />
<a href="http://memo-off.blogspot.jp/2013/06/mysql56.html">メモOFF: MySQL5.6がメモリを沢山お召し上がりになる件</a><br />
<br />
書いてあるとおり、<br />
<blockquote class="tr_bq">
table_definition_cache=400</blockquote>
をmy.cnfに足したら、無事起動した!adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-28048339998461591272017-02-04T14:52:00.002+09:002017-02-04T14:52:23.735+09:00abで負荷テスト<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://qiita.com/flexfirm/items/ac5a2f53cfa933a37192">Apache Benchでサクッと性能テスト - Qiita</a>
POSTしたい場合
<a href="http://onlineconsultant.jp/pukiwiki/?Apache%20ab(ApacheBench)%E3%81%A7%E8%B2%A0%E8%8D%B7%E3%83%86%E3%82%B9%E3%83%88%E3%81%99%E3%82%8B">Apache ab(ApacheBench)で負荷テストする -でじうぃき</a></pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-36880049818830930342017-02-04T14:49:00.001+09:002017-02-04T14:49:27.319+09:00nginxで AWS API Gatewayへの proxyができない<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">API GatewayはSNIなHTTPSのみ。
proxy_passしようとするとエラーが出る。</pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://qiita.com/sfujiwara/items/751061cac3964c8d5f36">nginxでproxy_pass先にSNIなhttpsを指定する - Qiita</a>
これだった!</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-68176612363064061212016-12-20T09:09:00.004+09:002016-12-20T09:09:59.302+09:00Itamaeでのファイル作成時の SELinuxによる 403エラーを回避<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">SELinuxが有効な環境でitamaeのfile resourceでファイルを生成すると、「user_tmp_t」というラベルが付与されてしまい、NginX等のWebサーバ経由でファイルにアクセスできない。
(ファイル生成時にいったん/tmpディレクトリを経由するためと思われる。)
パーミッションや所有者は問題ないのに403 Forbiddenになるので原因が分かりづらい。
(参考)ラベルは下記のようなコマンドで確認できる。
<blockquote class="tr_bq">
ls -Z パス</blockquote>
対策1. restoreconでラベルをリセットする
参考 <a href="http://totech.hateblo.jp/entry/2015/04/05/223714">ApacheでSELinuxが原因で403 Forbiddenエラー - カタカタブログ</a>
対策2. file resoureceを使わない
内容が短ければechoでなんとかする。
例 execute "echo 'ファイルに書きたい内容' > /path/to/file.txt"</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-73995698112230939712016-12-20T09:08:00.003+09:002016-12-20T09:08:31.920+09:00Linuxで SSH接続用鍵ファイルを作る方法<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://qiita.com/Y-Mukoyama/items/f20def019e25dc162ca8">公開鍵暗号を用いてのSSH接続(初歩) - Qiita</a>
<a href="http://kazmax.zpp.jp/linux/lin_sshrsa.html">鍵交換方式によるssh接続</a>
設定変更後、SSHDを再起動する。</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-59459142145077645952016-12-20T09:07:00.002+09:002016-12-20T09:07:33.057+09:00自己証明書をコマンド2発で作る方法<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">
</pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">自己署名のサーバ証明書、いわゆるオレオレ証明書をコマンド2つ(ただし長い)で作る方法。
itamaeやchefやansibleなんかに仕込みたい場合に、対話式じゃないほうが楽なのでメモ。
<blockquote class="tr_bq">
openssl req -nodes -new -newkey rsa:2048 -keyout server.key -out server.csr -subj "/C=JP/ST=State/L=Location/O=Organization/OU=OrganizationUnit/CN=ここにドメインを入れる"</blockquote>
<blockquote class="tr_bq">
openssl x509 -req -sha256 -days 3650 -signkey server.key -in server.csr -out server.crt</blockquote>
参考
<a href="http://qiita.com/ngyuki/items/146252102315282e1f12">MySQLでSSLクライアント証明書を使う - Qiita</a>
<a href="http://fdays.blogspot.jp/2015/01/2015.html">floatingdays: 自己証明書の作り方 2015年版</a></pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-38648274487254445662016-12-03T09:55:00.001+09:002016-12-03T09:55:47.517+09:00Firefoxで 英数字以外のドメインを「xn--」で始まるドメインで標示する設定<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://web.haioku.net/firefox-punycode/">Firefoxで日本語ドメインをPunycode(ピュニコード)で表示する方法 | WebMETAL</a>
http://日本語.jp/
↓
http://xn--wgv71a119e.jp/
Chromeはできないのか?</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-73886533316415734932016-11-23T18:07:00.002+09:002016-11-23T18:07:45.258+09:00Apacheで HTTPSのサイトをリバースプロキシする設定<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://kaorumori.hatenadiary.com/entry/20120717/1343581488">SSLのサイトへのProxyの設定 - 森薫の日記</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">"SSLProxyEngine On"を忘れずに。</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-12044893821065890602016-11-23T18:06:00.002+09:002016-11-23T18:06:58.167+09:00Redhat, CentOS 7のサービス(デーモン)のコマンド<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><b>chkconfig → systemctl</b>
<a href="http://www.server-memo.net/centos-settings/centos7/systemctl-enable.html">CentOS 7 サービス自動起動設定 | server-memo.net</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">"chkconfig --list"が"systemctl list-unit-files -t service"に長くなって覚えられない...
<b>service → systemctl</b>
chkconfigと統合されたのは分かりやすい</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-6166733541669178372016-11-19T16:40:00.002+09:002016-11-19T16:40:27.202+09:00Amazon API Gatewayでアクセス制限をかける方法<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://dev.classmethod.jp/cloud/cache-api-gateway-by-cloudfront/">Amazon CloudFrontでAPI Gatewayの痒いところに手を届ける | Developers.IO</a>
手前にCloudFront + AWS WAFを置くことにより接続元IPアドレス等でのアクセス制限ができる。</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-54441073605702046922016-11-19T16:39:00.001+09:002016-11-19T16:39:41.366+09:00X-frame-Optionsの ALLOW-FROMで指定できる URIは1つだけ<a href="https://codeiq.jp/magazine/2014/02/5736/">フロントエンドエンジニアなら知っておきたい「HTML5のセキュリティ問題と対策技術」第44回HTML5とか勉強会レポート #html5j #HTML5|CodeIQ MAGAZINE</a><br />
<br />
らしいadminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-42575781837931704712016-11-19T16:38:00.001+09:002016-11-19T16:38:13.950+09:00Let's Encrypt on Apache on Windows<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://calkinos.hatenablog.com/entry/2015/12/05/170829">Let's Encrypt を Windows Apacheで使ってみる。 - なんかてきとうに</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">自動更新用タスクも登録してくれるみたい
<a href="https://github.com/Lone-Coder/letsencrypt-win-simple/wiki">Home · Lone-Coder/letsencrypt-win-simple Wiki · GitHub</a>
最新(v1.9.1)の実行ファイルはTLS1.0非対応(#219)
<a href="https://github.com/Lone-Coder/letsencrypt-win-simple/releases">Releases · Lone-Coder/letsencrypt-win-simple · GitHub</a>
↓
TLS1.0が必要な場合、TLS1.0の再対応(#267)を取り込んだバージョンを待つか、自分でビルドするか。</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-39953232143595692742016-10-30T20:46:00.002+09:002016-10-30T20:46:38.668+09:00Squidでプロキシして TLS1.2に接続<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://kikumoto.hatenablog.com/entry/2016/06/04/124922">TLS1.2が使えない環境のためのProxy (squid)設定 - kikumotoのメモ帳</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">メモ</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-54677613207033705932016-10-30T20:42:00.000+09:002016-10-30T20:42:17.485+09:00RewriteRuleで URLエンコードをさせない設定<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;"><a href="http://d.hatena.ne.jp/Tetsujin/20100804/1280859353">mod_rewriteでリダイレクトあれこれ - てつじんにっき</a>
<blockquote class="tr_bq">
NE
No escape。URLエンコードを抑制する</blockquote>
</pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">
</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-4383604374854014342016-10-30T20:41:00.001+09:002016-10-30T20:41:08.186+09:00使われていないindexを見つける SQL<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">メモ。
■ MySQLの場合
<a href="https://yakst.com/ja/posts/4236">MySQLインデックスのお手入れの基本 | Yakst</a>
GithubにあるCreate ViewのSQLでVIEWを作って見るみたい。
MySQL5.6以降でないと動かないようだ。(参考 <a href="http://sawara.me/mysql/2251/">MySQLで使ってないインデックスを調べる方法 – sawara.me</a> )
■ PostgreSQLの場合
<a href="http://b.hatena.ne.jp/entry/303098282/comment/terazzo">postgresqlならselect * from pg_stat_user_indexes where idx_scan=0;とかですねー - terazzo のコメント / はてなブックマーク</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; user-select: text; white-space: pre-wrap; word-wrap: break-word;">試したら、開発環境では使われていないのがたくさんあったけど、本番環境ではみんなきれいに使われてた!</pre>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-60914255242118503342016-10-02T14:58:00.001+09:002016-10-02T14:58:25.746+09:00Excelの複数部数の印刷でエラー<a href="http://blog.livedoor.jp/nichepcgamer/archives/1060504879.html">【アプデ】 2016/08/25、KB3187022公開。KB3177725で印刷に不具合が起こる問題の修正パッチ : ニッチなPCゲーマーの環境構築</a><br />
<br />
メモ。もう起きなくなったが。adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0tag:blogger.com,1999:blog-8045516934271374857.post-91750517946106460702016-09-11T21:10:00.003+09:002016-09-11T21:10:39.012+09:00UMLをテキストで定義できるツール<pre class="a-b-r-La a-b-ja-Eb-Vb" style="-webkit-user-select: text; background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; white-space: pre-wrap; word-wrap: break-word;"><a href="http://blog.okazuki.jp/entry/2016/09/01/215508">Visual Studio Codeで自由自在にUMLを描こう - かずきのBlog@hatena</a></pre>
<pre class="a-b-r-La a-b-ja-Eb-Vb" style="-webkit-user-select: text; background-color: white; font-family: "Courier New", Courier, monospace, arial, sans-serif; font-size: 14px; white-space: pre-wrap; word-wrap: break-word;">Visual Studio Code + プラグイン(Java製)。
良さそう。
</pre>
<div>
<br /></div>
adminhttp://www.blogger.com/profile/05899076535344426659noreply@blogger.com0