Skip to content

Instantly share code, notes, and snippets.

user nginx;
worker_processes 1;
events {
worker_connections 1024;
use epoll;
}
http {
include mime.types;
#!/bin/sh
# -*- coding: utf-8 -*-
IPTABLES=/sbin/iptables
SERVICE=/sbin/service
SSH_PORT=22
$IPTABLES -F # すべてのチェインの内容を削除
$IPTABLES -P INPUT ACCEPT # INPUTチェインのポリシーをACCEPTにする
@saitodev
saitodev / post-receive
Last active December 21, 2015 04:18
git post-receive example implemented in python.
#!/usr/local/bin/python
# -*- coding: utf-8; mode: python -*-
import os
import os.path
import sys
import subprocess
WORK_DIR = '/path/to/work/dir'
GIT_DIR = os.path.join(WORK_DIR, '.git')
export PS1="-- \[\033[0;31m\]\u@\h \[\033[1;34m\]\w \[\033[0m\]-- \n> "
alias ls='ls -hF --color=tty'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias less='less -r' # raw control characters
alias grep='grep --color' # show differences in colourx
alias ll='ls -l -A' # long list
alias la='ls -A' # all but . and ..
;[unix_http_server]
;file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
username=admin ; (default is no username (open server))
[ -e /tmp/work/memcached ] || mkdir -p /tmp/work/memcached
cd /tmp/work/memcached
# ユーザーの作成
sudo /usr/sbin/useradd -s /sbin/nologin -d /var/run/memcached -M memcached
sudo mkdir /var/run/memcached
sudo chown memcached.memcached /var/run/memcached
# memcachedのビルド
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
[ -e /tmp/work/nginx ] || mkdir -p /tmp/work/nginx
cd /tmp/work/nginx
# ユーザーの作成
sudo /usr/sbin/useradd -s /sbin/nologin -d /var/lib/nginx -c "Nginx web server" -M nginx
# nginxのダウンロードとビルド
wget http://nginx.org/download/nginx-1.4.3.tar.gz
tar zxf nginx-1.4.3.tar.gz
cd nginx-1.4.3
@saitodev
saitodev / memcached
Created August 12, 2013 08:13
memcached init script for CentOS
#! /bin/sh
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# config: /etc/sysconfig/memcached
# Source function library.
. /etc/rc.d/init.d/functions
@saitodev
saitodev / nginx
Created August 12, 2013 07:56
nginx init script for CentOS
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
#!/bin/bash
container_id=$1
if [ -z $container_id ]; then
echo "usage: sudo docker-nsenter <container_id> [args ...]"
exit 1
fi
target=`docker inspect --format '{{.State.Pid}}' $container_id`
nsenter --mount --uts --ipc --net --pid --target $target ${@:2}