【備忘録】RailsでPostgreSQLを入れた際のエラー対処(Ubuntu)
どうもてぃです。
作成したwebアプリをherokuへあげるため、staging環境のみPostgreSQLを入れてテストをしようと思った次第です。
DB周りは安定してエラーが出るのでいつでも身構えて処理できますね。
実行環境
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
・ ・ ・ gem 'mysql', '>= 0.4.4', '< 0.6.0' gem 'pg', group: :staging ・ ・ ・
staging環境のみPostgreSQL。
本番環境はMySQLを使う予定(そもそもherokuでテスト運用するならPostgreSQLにすればよかった)。
bundle install
すると上記のエラー。
エラー内容は以下。
Fetching pg 1.1.3 Installing pg 1.1.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/user/project/vendor/bundle/ruby/2.5.0/gems/pg-1.1.3/ext /home/user/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20181005-30856-10oqjtj.rb extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/user/.rbenv/versions/2.5.0/bin/$(RUBY_BASE_NAME) --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/user/project/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/user/project/vendor/bundle/ruby/2.5.0/gems/pg-1.1.3 for inspection. Results logged to /home/user/project/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/gem_make.out An error occurred while installing pg (1.1.3), and Bundler cannot continue. Make sure that `gem install pg -v '1.1.3'` succeeds before bundling. In Gemfile: pg
gemをインストールしてみる
An error occurred while installing pg (1.1.3), and Bundler cannot continue. Make sure that `gem install pg -v '1.1.3'` succeeds before bundling.
こんなこと書いてたので安直にgem install
してみる。
$ gem install pg -v '1.1.3' Fetching: pg-1.1.3.gem (100%) Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension. current directory: /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/pg-1.1.3/ext /home/user/.rbenv/versions/2.5.0/bin/ruby -r ./siteconf20181005-31001-qz27e2.rb extconf.rb checking for pg_config... yes Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/user/.rbenv/versions/2.5.0/bin/$(RUBY_BASE_NAME) --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/pg-1.1.3 for inspection. Results logged to /home/user/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/pg-1.1.3/gem_make.out
おんなじエラーですね。
よく見てみると、ここらへんがヒントっぽい。
Using config values from /usr/bin/pg_config You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. checking for libpq-fe.h... no Can't find the 'libpq-fe.h header
てかそもそもlibpq-dev
って入ってるんかいな?
libpq-devを入れる
$ sudo apt install libpq-dev パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 提案パッケージ: krb5-doc krb5-user postgresql-doc-9.5 以下のパッケージが新たにインストールされます: comerr-dev krb5-multidev libgssrpc4 libkadm5clnt-mit9 libkadm5srv-mit9 libkdb5-8 libpq-dev アップグレード: 0 個、新規インストール: 7 個、削除: 0 個、保留: 198 個。 485 kB のアーカイブを取得する必要があります。 この操作後に追加で 2,528 kB のディスク容量が消費されます。 続行しますか? [Y/n] Y 取得:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libgssrpc4 amd64 1.13.2+dfsg-5ubuntu2 [54.5 kB] 取得:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkdb5-8 amd64 1.13.2+dfsg-5ubuntu2 [37.1 kB] 取得:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkadm5srv-mit9 amd64 1.13.2+dfsg-5ubuntu2 [51.3 kB] 取得:4 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libkadm5clnt-mit9 amd64 1.13.2+dfsg-5ubuntu2 [36.7 kB] 取得:5 http://jp.archive.ubuntu.com/ubuntu xenial/main amd64 comerr-dev amd64 2.1-1.42.13-1ubuntu1 [38.2 kB] 取得:6 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 krb5-multidev amd64 1.13.2+dfsg-5ubuntu2 [113 kB] 取得:7 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libpq-dev amd64 9.5.14-0ubuntu0.16.04 [154 kB] 485 kB を 1秒 で取得しました (313 kB/s) 以前に未選択のパッケージ libgssrpc4:amd64 を選択しています。 (データベースを読み込んでいます ... 現在 329939 個のファイルとディレクトリがインストールされています。) .../libgssrpc4_1.13.2+dfsg-5ubuntu2_amd64.deb を展開する準備をしています ... libgssrpc4:amd64 (1.13.2+dfsg-5ubuntu2) を展開しています... 以前に未選択のパッケージ libkdb5-8:amd64 を選択しています。 .../libkdb5-8_1.13.2+dfsg-5ubuntu2_amd64.deb を展開する準備をしています ... libkdb5-8:amd64 (1.13.2+dfsg-5ubuntu2) を展開しています... 以前に未選択のパッケージ libkadm5srv-mit9:amd64 を選択しています。 .../libkadm5srv-mit9_1.13.2+dfsg-5ubuntu2_amd64.deb を展開する準備をしています ... libkadm5srv-mit9:amd64 (1.13.2+dfsg-5ubuntu2) を展開しています... 以前に未選択のパッケージ libkadm5clnt-mit9:amd64 を選択しています。 .../libkadm5clnt-mit9_1.13.2+dfsg-5ubuntu2_amd64.deb を展開する準備をしています ... libkadm5clnt-mit9:amd64 (1.13.2+dfsg-5ubuntu2) を展開しています... 以前に未選択のパッケージ comerr-dev を選択しています。 .../comerr-dev_2.1-1.42.13-1ubuntu1_amd64.deb を展開する準備をしています ... comerr-dev (2.1-1.42.13-1ubuntu1) を展開しています... 以前に未選択のパッケージ krb5-multidev を選択しています。 .../krb5-multidev_1.13.2+dfsg-5ubuntu2_amd64.deb を展開する準備をしています ... krb5-multidev (1.13.2+dfsg-5ubuntu2) を展開しています... 以前に未選択のパッケージ libpq-dev を選択しています。 .../libpq-dev_9.5.14-0ubuntu0.16.04_amd64.deb を展開する準備をしています ... libpq-dev (9.5.14-0ubuntu0.16.04) を展開しています... libc-bin (2.23-0ubuntu10) のトリガを処理しています ... man-db (2.7.5-1) のトリガを処理しています ... doc-base (0.10.7) のトリガを処理しています ... doc-base ファイルを 1 個追加 を処理中... scrollkeeper をドキュメントとして登録しています... install-info (6.1.0.dfsg.1-5) のトリガを処理しています ... libgssrpc4:amd64 (1.13.2+dfsg-5ubuntu2) を設定しています ... libkdb5-8:amd64 (1.13.2+dfsg-5ubuntu2) を設定しています ... libkadm5srv-mit9:amd64 (1.13.2+dfsg-5ubuntu2) を設定しています ... libkadm5clnt-mit9:amd64 (1.13.2+dfsg-5ubuntu2) を設定しています ... comerr-dev (2.1-1.42.13-1ubuntu1) を設定しています ... krb5-multidev (1.13.2+dfsg-5ubuntu2) を設定しています ... libpq-dev (9.5.14-0ubuntu0.16.04) を設定しています ... libc-bin (2.23-0ubuntu10) のトリガを処理しています ...
うまくいった。
再びgem install
$ gem install pg -v '1.1.3' Building native extensions. This could take a while... Successfully installed pg-1.1.3 Parsing documentation for pg-1.1.3 Installing ri documentation for pg-1.1.3 Done installing documentation for pg after 0 seconds 1 gem installed
お、はいったぞ。
そして無事bundle install
も通りました。
これからherokuへデプロイするぞー。
【備忘録】link_toでhtmlタグを渡したいとき
最近Railsの開発をはじめました。
どうもてぃです。
例えば <i class="fas fa-user">
のアイコンに対して link_to
を使ってリンク化したいとき、ありますよね。
そんな時は、 link_to(<path>, <styleとか>) do
を使う。
前の会社でRailsをガシガシやってた時に使ったので、そういやそんなのあったなーてな感じで調べたら出てきた。
<%= link_to(users_path, style: 'color:#fff') do %> <i class="fas fa-user pa_r10"></i>アカウント設定 <% end %>
ヘッダーの右上に配置。
クリックしてアカウント設定画面に遷移できるようになりました。
【雑記】GCPにsshログインした時にチョコボ4匹を出現させた
Qiitaの転載です。
なぜやったか
AWSがあるならGCPもだろ! ってな感じで、Qiitaの記事見た瞬間に業務をほったらかしにしてやってしまいました。
全く後悔はありません、むしろ清々しいです。
チョコボを調達
https://github.com/dot-motd/final-fantasy こちらのgistを拝借させていただきました。
設定の確認
$ ssh gcp-test Last login: Tue Sep 25 17:26:06 2018 from s8.hfukuokafl1.vectant.ne.jp __ ____ _______ ___ _ _____ __________ / //_/ / / / ___// | / | / / | / ____/ _/ / ,< / / / /\__ \/ /| | / |/ / /| |/ / __ / / / /| / /_/ /___/ / ___ |/ /| / ___ / /_/ // / /_/ |_\____//____/_/ |_/_/ |_/_/ |_\____/___/ Version 8.4.0-3, Powered by Prime Strategy.
sshしたときにkusanagiを使っているので、それっぽいのが出てきます。
/etc/motd
をrootユーザーで確認。
$ cat /etc/motd __ ____ _______ ___ _ _____ __________ / //_/ / / / ___// | / | / / | / ____/ _/ / ,< / / / /\__ \/ /| | / |/ / /| |/ / __ / / / /| / /_/ /___/ / ___ |/ /| / ___ / /_/ // / /_/ |_\____//____/_/ |_/_/ |_/_/ |_\____/___/ Version 8.4.0-3, Powered by Prime Strategy.
これですね。
試しに書き込んで、もう一度ssh接続してみる。
$ vim /etc/motd __ ____ _______ ___ _ _____ __________ / //_/ / / / ___// | / | / / | / ____/ _/ / ,< / / / /\__ \/ /| | / |/ / /| |/ / __ / / / /| / /_/ /___/ / ___ |/ /| / ___ / /_/ // / /_/ |_\____//____/_/ |_/_/ |_/_/ |_\____/___/ Version 8.4.0-3, Powered by Prime Strategy. テストでやんす # sshログアウト $ exit $ ssh gcp-test Last login: Tue Sep 25 17:26:06 2018 from s8.hfukuokafl1.vectant.ne.jp __ ____ _______ ___ _ _____ __________ / //_/ / / / ___// | / | / / | / ____/ _/ / ,< / / / /\__ \/ /| | / |/ / /| |/ / __ / / / /| / /_/ /___/ / ___ |/ /| / ___ / /_/ // / /_/ |_\____//____/_/ |_/_/ |_/_/ |_\____/___/ Version 8.4.0-3, Powered by Prime Strategy. テストでやんす
じゃあこれに直接書き込めば良さそう。
設定
ちゃんとcurlで取れているか確認。
おっけい。
$ curl -s https://gist.githubusercontent.com/makocchi-git/9775443/raw/70b3e0250a0d07be3c4dcdaed3dff5662e2a7ab4/chocobo-allstar.txt | sudo tee -a /etc/motd
上記のコマンド実行後、最後sshで接続。
問題点
AWSのようにupdate-motd.d
がなかったので、サーバーを再起動すると設定が消えちゃう可能性があります(試してない)。
特に調査せずやったので、後日暇があればやってみようとおもいます。
現状再起動をほとんどやらないサーバーでやったので、今回はこのままにしときます。
チョコボ可愛い
スライム可愛い
チョコボも可愛い
今度上司が接続するサーバーにチョコボ仕込んどきます。
追記
はぐれメタルも可愛い。
【メモ】docker runにおけるオプションまとめ
どうもってぃです。
dockerやらなかったらすぐわすれちゃいますよね。
なので、復習をかねて docker run
時のオプションについてまとめました。
コンテナの生成 & 起動
docker run
でコンテナの生成 & 起動を行います。
$ docker run [オプション] イメージ名[:タグ名][引数]
この時のオプションを以下にまとめる。
コンテナの生成・起動(単純なオプション)
-a : 標準入力、標準出力、標準エラー出力にアタッチする --cidfile="ファイル名" : コンテナIDをファイルに出力する -d, --detach=false : コンテナを生成し、バックグラウンドで実行する -i, --interactive=false : コンテナの標準入力を開く -t, --tty=false : tty(端末デバイス)を使う --name : コンテナ名
コンテナのバックグラウンド実行
-d, --detach=false : 同上 -u, --user="ユーザー名" : ユーザー名を指定する --restart=[no | on-failure | on-failure:回数n | always] : コマンドの実行結果によって再起動を行うオプション no : 再起動しない on-failure : 終了ステータスが0出ない時に再起動する on-failure:回数n : 終了ステータスが0出ない時にn回再起動する always : 常に再起動する --rm : コマンド実行完了後にコンテナを自動で削除する
コンテナのネットワーク設定
--add-host=[ホスト名:IPアドレス] : コンテナの/etc/hostsにホスト名とIPアドレスを定義する --dns=[IPアドレス] : DNSサーバーのIPアドレス指定 --expose=[ポート番号] : 指定したレンジのポート番号を割り当てる --mac-address=[MACアドレス] : コンテナのMACアドレスを指定する --net=[bridge | none | conrainer:<name|id> | host] : コンテナのネットワークを指定する bridge : ブリッジ接続を行う none : ネットワークに接続しない container:[name|id] : 他のコンテナのネットワークを使う host : コンテナがホストOSのネットワークを使う -h, --host="ホスト名" : コンテナ自身のホスト名を指定する -p, --publish-all=[true | false] : ホストの任意のポートをコンテナに割り当てる --link=[コンテナ名:エイリアス] : 他のコンテナからアクセスするときの名前
リソースを指定してコンテナを生成・実行
-c, --cpu-shares=0 : CPUの使用の配分 -m, --memory=[メモリ使用量] : 使用するメモリを制限して実行する -v, --volume=[ホストのディレクトリ]:[コンテナのディレクトリ] ホストとコンテナのディレクトリを共有
コンテナを生成・起動する環境を指定
-e, --env=[環境変数] : 環境変数を指定する --env-file=[ファイル名] : 環境変数をファイルから設定する --privileged=[true | false] : 特権モードで起動する(ホストのカーネル昨日も操作可) --read-only=[true | false] : コンテナのファイルシステムを読み込み専用にする -w, --workdir=[パス] : コンテナの作業ディレクトリを指定する
おわり
おそらくすべて覚えるのは難しいので、よく使われるものを中心に覚えていくのがいいかと思います。
僕も結構忘れてたので覚え直します。
【Linuxコマンド】特定の文字列を含むファイルを検索する
こんにちはもてぃです。
前のエントリも合わせて記事にします。
特定の文字列を検索して、文字列置換まで合わせてやりたいと思ったので備忘録として。。。
findを使う
$ find . -type f -print | xargs grep '検索したい文字列'
最初はこれをうまく使ってやろうと思いました。
が、これだと検索したファイル名のパス:検索した文字列
の形で出てきます。
例えばこんな感じ。
$ cd html # => 配下にindex.html, mobile.htmlなどがあるとする $ find . -type f -print | xargs grep 'head' ./html/index.html: <head> ./html/index.html: </head> ./html/mobile.html: <head> ./html/mobile.html: </head>
文字列置換と合わせてやりたい場合に後ろの検索した文字列は本当に邪魔。
どうにかして、ファイルパスのみ表示したかった。。。
ということでgrepを再帰的に使う
grepのオプションを使えば解決出来ました。
-r : 再帰的にgrepコマンドを実行 -n : 行番号を表示する -w : 文字列全体にマッチする場合 -l : ファイル名だけを出力
-l : ファイル名だけを出力
これらをうまく使います。
$ grep -rlw . -e 'head' ./html/index.html ./html/index.html ./html/mobile.html ./html/mobile.html
あとはxargs
とsed
を使って、文字列を置換してやればおkって感じです。
以下はSSL化の際のhttpをhttpsへ置換するコマンド。
# カレントディレクトリ配下全てのファイルのhttpをhttpsへ置換 $ grep -rlw . -e 'https' | grep html | xargs sed -i -e 's/http:/https:/g'
終わりに
以下の記事を参考に致しました。
ありがとうございます。
nginxのエラーログが出力されない時は。。。
参考にしたのは以下の本。
エラー画面が出ているのに全然エラーログが吐き出されなかったのですが、この本に助けられました。
nginx.conf
kusanagiコマンドでwordpress環境を構築しました。
以下がnginx.conf
rootは /etc/nginx/nginx.conf
で設定しています。
## default HTTP server { listen 80; server_name default_server; access_log /home/kusanagi/wordpress/log/nginx/access.log main; error_log /home/kusanagi/wordpress/log/nginx/error.log warn; index index.php index.html index.htm; charset UTF-8; client_max_body_size 16M; location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location ~* /\.well-known { allow all; } # 以下ネストが変になってます。 location ~* /\. { deny all; } #include templates.d/multisite.conf; location ~* /(?:uploads|files)/.*\.php$ { deny all; } location ~* \.(jpg|jpeg|gif|png|css|js|swf|ico|pdf|svg|eot|ttf|woff)$ { expires 60d; access_log off; } location ~* /blog/wp-login\.php|/wp-admin/((?!(admin-ajax\.php|images/)).)*$ { satisfy any; allow 0.0.0.0/0; allow 127.0.0.1; deny all; auth_basic "basic authentication"; auth_basic_user_file "/home/kusanagi/.htpasswd"; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffers 256 128k; fastcgi_buffer_size 128k; fastcgi_intercept_errors on; fastcgi_read_timeout 120s; #include naxsi.d/wordpress/*.conf; } #include naxsi.d/wordpress/*.conf; } location ~ [^/]\.(php|html)$ { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffers 256 128k; fastcgi_buffer_size 128k; fastcgi_intercept_errors on; fastcgi_read_timeout 120s; set $do_not_cache 1; ## page cache set $device "pc"; if ($request_method = POST) { set $do_not_cache 1; } if ($query_string != "") { set $do_not_cache 1; } if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { set $do_not_cache 1; } if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { set $do_not_cache 1; } if ($http_user_agent ~* " Android |\(iPad|Android; Tablet; .+Firefox") { set $device "tablet"; } if ($http_user_agent ~* " Android .+ Mobile |\(iPhone|\(iPod|IEMobile|Android; Mobile; .+Firefox|Windows Phone") { set $device "smart"; } fastcgi_cache wpcache; fastcgi_cache_key "$device:$request_method:$scheme://$host$request_uri"; fastcgi_cache_valid 200 10m; fastcgi_no_cache $do_not_cache; fastcgi_cache_bypass $do_not_cache; add_header X-F-Cache $upstream_cache_status; add_header X-Signature KUSANAGI; #include naxsi.d/wordpress/*.conf; } }
デフォルトの http.conf
で一旦試してます。
現象
wordpress
をサブディレクトリにして、特定のリンクを踏んだら、別のディレクトリを読み込むような設定をやっている最中突然エラーログが出なくなりました。
というより、そのリンクを踏んだ時だけエラーが出ずに詰んでました。
解決策
エラーの log level
が原因でした。
## default HTTP server { listen 80; server_name default_server; access_log /home/kusanagi/wordpress/log/nginx/access.log main; error_log /home/kusanagi/wordpress/log/nginx/error.log debug; index index.php index.html index.htm; charset UTF-8; client_max_body_size 16M; ・ ・ ・
log level
を一番下の debug
にしてみたら notice
が表示された。
これでやっと前に進めそうです。
最後に
ログの出力先に全く問題がないときにはログレベルを疑いましょう(超反省)。
ポケットリファレンスは小さくてマジで便利ですね。おすすめです。
【雑記】ちょっと暇だったのでvimでtwitterできるようにした
どうもってぃです。
有名なTwitVimをインストールしたのでその手順を公開。
環境
- elementary OS 0.4.1 Loki ( Ubuntu 16.04.5 )
- curl 7.47.0 (x86_64-pc-linux-gnu)
- OpenSSL 1.0.2g 1 Mar 2016
TwitVimをインストール
以下のリンクが最新のTwitVimです。
https://www.vim.org/scripts/download_script.php?src_id=23560
一応ここ(https://www.vim.org/scripts/script.php?script_id=2204)で最新がどれか確認してファイルをダウンロードしてください。
今回はtwitvim-0.9.1.vmb
をダウンロードします。
ファイルをダウンロードしたら、vimでtwitvim-0.9.1.vmb
を開きます。
$ vim ~/Downloads/twitvim-0.9.1.vmb
開いたら、:so %
でインストール。
僕の場合パッケージはNeoBundle
でなくdein.vim
です。一瞬で終わりました。
TwitVimの設定と認証
自分のアカウントにログインするためにTwitVimで認証をする必要が有ります。
その際に開くブラウザを指定するのとちょっとした設定を.vimrc
へ記載します。
" vimでtwitter let twitvim_enable_python = 1 let twitvim_browser_cmd = 'google-chrome' let twitvim_force_ssl = 1 let twitvim_count = 40
twitterはSSLじゃないとアクセスできないみたいですね。
なのでtwitvim_force_ssl
を有効にしてます。
またtwitvim_browser_cmd
でブラウザ指定をします。
今回はubuntuベースのelementaryOSでやっているので、google-chrome
でchromeを指定してます(ターミナルでgoogle-chrome
と打てば開いたので指定したらうまくいった)。
りんごさんや窓くんは別の指定方法があるようなのでggrk
上記を記載したら、:so ~/.vimrc
で設定を反映。 :SetLoginTwitter
とタイプすると、chromeが開いて認証画面が出てきます。
認証を完了すると、PINコードが出てくるのでターミナル上に打ち込むとTwitVimでの認証が終わります。
Let's enjoy twitter life !!
仕事をしてるふうにtwitterをしましょうbbbbbbbbbbbbbbbbbbbbbbbbbb