nginx

chef solo入門勉強中ninxが立ち上がらなかったので調査

ちなみにosはubunts

 

まずは構文チェック

/usr/sbin/nginx -t
/usr/sbin/nginx -t -c /etc/nginx/nginx.conf

http://shiken.infrabu.info/nginx/nginx%E3%81%A7%E8%A8%AD%E5%AE%9A%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E6%A7%8B%E6%96%87%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF/

 

 

ほんでuserの値とかチェック

http://blog.infinity-dimensions.com/2012/07/ubuntu-nginx-config-setting.html

 

 

これが正解

vim site-cookbooks/nginx/templates/default/nginx.conf.erb

user www-data;

worker_processes 1;

error_log /var/log/nginx/error.log;

pid /var/run/nginx.pid;

 

events {

  worker_connections 1024;

}

 

http {

  include /etc/nginx/mime.types;

  default_type application/octet-stream;

 

  server {

    listen <%= node['nginx']['port'] %>;

    server_name localhost;

    location / {

      root /usr/share/nginx/www;

      index index.html index.htm;

    }

  }

}

 

おまけ

 

package "nginx" do

  action :install

end

 

service "nginx" do

  supports :status => true, :restart => true, :reload => true

  action [:enable, :start]

end

 

 

vim site-cookbooks/nginx/recipes/default.rb

template "nginx.conf" do

  path "/etc/nginx/nginx.conf"

  source "nginx.conf.erb"

  owner "root"

  group "root"

  mode 0644

  notifies :reload, 'service[nginx]'

end

 

 

なんかいつか参考になるかな

http://k-mats.github.io/blog/2013/04/12/no-network-on-vagrant/

 

  [Mac]『入門Chef Solo』を読んで試してみた

http://blog.hello-world.jp.net/?p=461

 

 

自分の中でブレイクしている、vagrant + chef + gitで開発環境を構築する

http://box406.hatenablog.com/entry/2013/06/01/010715

 

 

「写経」から始めるChefクックブックの作成

http://heartbeats.jp/hbblog/2013/03/chef-recipe-and-lib.html