nginx

nginxでエラーページを変える

error_pageディレクティブを使う error_page code ... [=[resonse code]] uri; 例えば以下の様な感じ server { listen 80 default_server; location /static { root /var/www; } error_page 404 /static/404.html; } /var/www/static/404.html oops 400,401,…

nginxでbasic認証かける

nginxでbasic認証 htpasswd使うのにapache2-utils入れる sudo apt-get install apache2-utils その後password用のファイル作る $ sudo htpasswd -c .htpasswd admin New password: Re-type new password: Adding password for user admin 設定ファイルで以下…

nginxで違うportのprocessにproxyする

内部のプロセスにproxy :8000で動いているSimpleHTTPServerにproxy python -m SimpleHTTPServer 8000 で動かしたhttp serverに/python/でアクセスした場合にproxyするようにする設定。 /etc/nginx/conf.d/proxyserve.conf server { listen 80 default_server…

ほんとに1からnginx触る

vagrantの環境用意 hnakamur/ubuntu-14.04-x64 https://vagrantcloud.com/hnakamur/ubuntu-14.04-x64 nginx install sudo apt-get install nginx curl sudo service nginx start curl http://localhost:80 ok nginxの設定を有効にする /etc/nginx/nginx.conf…