2013年5月20日月曜日

iPhoneのGmailアプリで外部アカウントからメール送信

PCから設定します

まず外部アカウント(hogehoge@hoge.jp)をGmailアカウント(gmail@gmail.com)に追加します

Gmailの設定→アカウント→エイリアスで、
追加した外部アカウントを指定(デフォルトに指定)


iPhoneのGmailアカウントで送信
hogehoge@hoge.jpから送信されているか確認

vim中断と復帰

vim中に別のコマンドを実行したい、けど新しくタブやウインドウを開くのもめんどくさい、vimを閉じるのはもってのほか

そういう時にControl+Zで中断できる
fgコマンドでフォアグラウンドジョブとして復活

2013年5月5日日曜日

nginxで動かしてるwordpressの設定をいじったら503になってしまった

適当に設定いじってたらアクセスできなくなってしまった!!!!
たぶんパーマリンクの設定いじったせい…な気がする いや、違うか? とにかく多分設定ファイルいじったせいだと思われる

 Apacheだど.htaccess設置したりして回避してたみたいだけど、
nginxにそんなものはないので設定ファイルいじって何とかしないとダメらしい

以下設定

パスは適宜変更

location /wordpress {
    root /var/www/html;
    index index.html index.html index.php;
    if (-f $request_filename) {
      expires 30d;
      break;
    }
    if (!-e $request_filename) {
      rewrite ^.+?($/wp-.*) $1 last;
      rewrite ^.+?(/.*\.php)$ $1 last;
      rewrite ^ /wp/index.php last;

    }
  }

nginx -tして怒られなかったら再起動
403解消!
参考:http://hima-j.in/wordpress/nginx-wordpress-permalink/


nginxちゃん何しとん?

if文の中のrewriteとか
参考:http://wiki.nginx.org/HttpRewriteModule
This module makes it possible to change URI using regular expressions (PCRE), and to redirect and select configuration depending on variables.
If the directives of this module are given at the server level, then they are carried out before the location of the request is determined. If in that selected location there are further rewrite directives, then they also are carried out. If the URI changed as a result of the execution of directives inside location, then location is again determined for the new URI.
This cycle can be repeated up to 10 times, after which Nginx returns a 500 error.
ほうほうなるほどなるほど… わからん

-fはファイルの存在をチェック-eはファイル、ディレクトリ、シンボリックリンクの存在をチェック
breakはセット完了
expires 30dってのはexpiresヘッダくっつけて30日間キャッシュさせるってことでいいのかな
rewriteってのは…正規表現と置換文字列にあわせてURIを変換してくれる??なんすかそれ。
phpで自動生成される解り辛いuriを日付/タイトルみたいな静的uriに変更してくれる的なことをやってくれるの?
lastっていうので書き換えを適用させてるみたいだけど…。
$request_filenameってのは要求されたパスでいいのかな。hoge/wordpressみたいな
参考:http://wiki.nginx.org/HttpCoreModule#.24request_filename


あと503は回避できたけどパーマリンク変更したあと記事見ようとすると
no input file specified nginx
ってなるようになってしまった
これはまたこんど解決しよう


以上色々間違ってそうなざっくりメモ