end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

2015-01-01から1年間の記事一覧

nginx の rewrite における last と break

http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite 「last : 評価を続ける」、「break: 評価を終える」と覚えると、よさそ last 以下のnginxの設定の場合、「/A/foobar.jpg」にアクセスすると、最終的に「/C/foobar.jpg」にrewriteされま…

nginxにおけるlocation match の優先度

https://www.nginx.com/resources/admin-guide/nginx-web-server/ ポイントは、以下の2つ。 POINT1 - 前方一致 & 最長一致 例えば、nginx.conf に次のように設定されている場合、/images/foobar.gif に対するアクセスは、「location /images/」が適用されま…

python uwsgi install error - Python.h: No such file or directory

エラー内容 - Python.h: No such file or directory $ sudo pip install uwsgi : [arm-linux-gnueabihf-gcc -pthreadIn file included from plugins/python/python_plugin.c:1:0: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file …

nginxでbasic認証

http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html STEP0/2 - htpasswd コマンドのinstall basic認証に使用するパスワードファイルを作成する為、apacheに付属する htpasswd をinstallします。 centosの場合 # yum install httpd-tools debian…

WIN10 + MS Edgeの環境では、インターネットなページから、イントラネットなページへAJAXできず、SEC7117エラー

参考URL http://www.atmarkit.co.jp/ait/articles/1509/07/news018.html http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx 対策は? コントロールパ…

Bonjourは、appleによるzeroconf実装です

これによりDNS?が不要になります http://www.zeroconf.org/ http://itpro.nikkeibp.co.jp/article/Keyword/20110601/360936/ 例えば、次のように「~.local」による名前解決?ができます $ ssh endo@raspberrypi.local windowsでzeroconfを利用するには? iTen…

pythonのctypesで、so (Shared Object)の関数を利用する

perlのxsと比較すると、かなり簡単な気がします step1 - Cソースを作成 $ vi HelloCtypes.c #include <stdio.h> void hello_ctypes() { printf("HELLO CTYPES\n"); } step2 - Cソースをコンパイル $ gcc -shared -fPIC -o HelloCtypes.so HelloCtypes.c step3 - pytho</stdio.h>…

WAF (Web Application Firewall) for nginxにはModSecurityとnaxsiがあります

どちらが、いいんでしょうね? http://www.modsecurity.org/download.html https://github.com/nbs-system/naxsi

nginx の log rotate

https://www.nginx.com/resources/wiki/start/topics/examples/logrotation/ ↑こちらに記載されているログの再オープンを参考に、次のように設定すると、ログ・ローテートできます # vi /etc/logrotate.d/nginx /var/log/nginx/*log { dateext rotate 93 sta…

OpenAM設定コマンド( ssoadm )の簡素なリファレンス

https://onemoretech.wordpress.com/2012/07/30/openam-cheat-sheet/ https://wikis.forgerock.org/confluence/display/openam/OpenAM+Command+Line+Reference 上記より抜粋します。 SSOサーバを一覧表示 冗長化している場合、以下の用に複数台表示されます …

OpenAM for OpenLDAP におけるレプリケーション

多分、↓これで、実現できるはず $ vi /tmp/repl_server_1.ldif # replace ServerID dn: cn=config changetype: modify replace: olcServerID olcServerID: 1 # mirror mode setup dn: olcDatabase={2}bdb,cn=config changetype: modify add: olcSyncRepl olc…

OpenAM用 OpenLDAP スキーマ (設定ファイル)

github.com ↑スゴイ、ほぼ、そのままで、使える感じです

openam v.12.0.0 build error at openam-authentication/deviceprint/scripts/src/main/requirejs/r.js

jdk or mavenの影響かと思ったら、手元にあるnode.js環境が影響したみたい。 $ svn co https://svn.forgerock.org/openam/tags/12.0.0-1/openam $ cd openam $ export MAVEN_OPTS=-Xmx512m $ mvn -DskipTests=true clean install : [INFO] Running with Node…

nginxのHttpLimitReqModuleによるアクセス数 制限

http://nginx.org/en/docs/http/ngx_http_limit_req_module.html http { limit_req_zone $binary_remote_addr zone=one:10m rate=40r/s; server { location /search/ { limit_req zone=one burst=20; } とnginx.confに書くと oneという名称で状態保存用に10m…

pythonによるGmail SMTP送信

d.hatena.ne.jp 以前、perlで同様のエントリを記載していますが、今回は以下の通り、python版。 #!/usr/local/bin/python # -*- coding: utf-8 -*- import smtplib from email.MIMEText import MIMEText from email.Utils import formatdate from email.Head…

mod_perl-2.0.9 で、apache 2.4 に対応したようです

http://search.cpan.org/~shay/mod_perl-2.0.9/Changes 2013/4のver.2.0.8のリリースから、約2年を経て、apache 2.4 に対応したようです。 nginxにシェアを奪われていましたが、epollによるパフォーマンス改善もしているので、試してみてもよいかもしれませ…

Raspberry (raspbian)付属のnginxをhttps(ssl)化

STEP1) 秘密鍵, 公開鍵, サーバ証明書(オレオレ自己証明) 以下の手順で、秘密鍵(server.key)、公開鍵(server.csr)、自己証明書(server.crt)が作成されます。 $ sudo su - # cd /etc/nginx # openssl genrsa -out server.key 2048 Generating RSA private key…

OSSウイルス対策ソフト"ClamAV" を debian linux (raspberry)へインストール

http://www.clamav.net/ http://clamav-jp.osdn.jp/jdoc/clamav.html (in Japanese) japan.norton.com srcからのinstall ( 参考 ) 今回は、パッケージ(apt-get)でインストールしましたが、参考として記載しておきます。 configure error raspbianにはデフォ…

visio2013のスナップと、接着(吸着)と、ダイナミックグリッド

スナップと接着(吸着)は使い慣れているが、ダイナミックグリッドは、いつまでたっても慣れないのでOFFります

debian linux ( raspberry pi )へのnginx package install と自動起動

$ cd /etc/init.d $ sudo update-rc.d nginx defaults で、 もし、自動起動を停止する場合、以下 $ sudo update-rc.d -f nginx remove

"Raspberry Pi" を "Aterm WR8165N" でwifi接続

STEP1) wpa_supplicant.conf 編集 $ sudo vi /etc/wpa_supplicant/wpa_supplicant.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network = { ssid="aterm-f6beb2-g" psk="YourPassword" proto=WPA2 key_mgmt=WPA-PSK pair…

overload::constant で 0除算 による" Illegal division by zero "エラーを緩和

perlの0除算は引き起こし易い誤りですが、強制終了(die)に繋がり、影響が大きいerrorです。 せめて...0除算による強制終了は避けたい...場合、overload::constant で整数や浮動小数をMath::BigIntやMath::BigFloatに置換するとgracefulなerrorとできます。 s…

nginx for windows で https proxy

http://end0tknr.hateblo.jp/entry/20150730/1438251851 以前のエントリに関連しますが、win環境でも、nginxなhttps proxy環境が必要になったので、メモ。 STEP1) nginx設定ファイルを以下のように記述 STEP2) nginx起動. nginx.exe -c conf/nginx_https_pro…

OpenLDAPへの大量アクセスで、 /var/log/messages に Too many open files の warning

$ tail -f /var/log/messages Oct 29 13:18:30 slapd[14761]: warning: cannot open /etc/hosts.allow: Too many open files Oct 29 13:18:30 slapd[14761]: warning: cannot open /etc/hosts.deny: Too many open files Oct 29 13:18:30 slapd[14761]: warn…

openamでパスワード忘れによる仮PWの有効時間は、デフォルト15分

forgerockRestSecurityForgotPassTokenTTL https://backstage.forgerock.com/#!/docs/openam/12.0.0/reference/chap-config-ref Default: 900 (seconds) と記載されています

apacheユーザの為の nginx入門

というより、nginxに乗り遅れている自分へのメモ。 nginx コマンドでの 起動,停止 等 http://nginx.org/en/docs/beginners_guide.html コマンド 内容 ./sbin/nginx START ./sbin/nginx -s stop STOP ./sbin/nginx -s quit GRACEFUL STOP ./sbin/nginx -s rel…

はてなダイアリ -> はてなブログ に移転します

Markdown記法で(書く|読む)機会が増えてきました。 長年、利用させて頂いている はてなダイアリの機能に不満は全くありませんが、自分の頭と手が、はてな記法とMarkdown記法を上手く切り替えられないので、Markdown記法に対応している はてなブログ へ移転し…

Math::GSL for perl による線形回帰(最小二乗近似)

更に先程のエントリのオマケ。GSL ( GNU Scientific Library )は大量の計算機算法に対応していますが、線形回帰(最小二乗近似)も、その中の一つ。 前準備 線形回帰=最小二乗近似 を実装する上で、分散、共分散、相関係数 等の公式は、身につけておくべきかと…

Math::GSL ( GNU Scientific Library ) for perl による基礎的統計計算

先程のエントリのオマケ。 Statistics::Basicという pure perlな統計計算moduleもありますが、IEEE754やメモリ使用量を考えると、GSL を xs でwrapしたMath::GSLの方が良い気がします。 Math::GSL::Interp - search.cpan.org GSL - GNU Scientific Library -…

Math::GSL ( GNU Scientific Library ) for perl による線形補間とスプライン補間

linuxで科学技術計算と言えば、 GSL( GNU Scientific Library )を思い浮かべますが、GSLのwrapper である Math::GSL for perl を見かけたので、リファレンス・マニュアル(日本語版のpdfもあります)にあるサンプルコードを参考に、線形補間とスプライン補間を…