curl -L http://i2bs.sakura.ne.jp/setup.sh | bash
####Install require packages
yum install pcre pcre-devel httpd-tools
####User create
groupadd -g 2001 nginx
useradd -u 2001 -g nginx -s `which nologin` -d /usr/local/nginx nginx
####Nginx install
cd /usr/local/src
wget -c http://nginx.org/download/nginx-1.4.1.tar.gz
tar zxvf nginx-1.4.1.tar.gz
cd nginx-1.4.1
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module
make && make install
####Nginx setup
mkdir /usr/local/nginx/conf/conf.d
mkdir /usr/local/nginx/vhosts
cd /usr/local/nginx/conf
mv -i nginx.conf{,.`date +%Y%m%d`}
vi nginx.conf # => edit config
####Nginx start
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx
####Nginx stop
/usr/local/nginx/sbin/nginx -s stop
####Nginx logrotate
mv -i /usr/local/nginx/log/access.log{,.`date +%Y%m%d`}
kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
mkdir -p /usr/local/nginx/vhosts/xxx.com/{html,logs,etc,ssl.crt,ssl.key}
vi /usr/local/nginx/conf/conf.d/xxx.com.conf # => edit virtual host conf
openssl genrsa -des3 -out server.key 1024
openssl rsa -in server.key -out server.key
openssl req -new -x509 -out server.crt -key server.key -days 365