Skip to content

Instantly share code, notes, and snippets.

@pacojp
pacojp / init_ec2.sh
Last active December 18, 2015 01:28
#!/bin/bash
#
# # sample usage
# curl -o /tmp/init_ec2.sh https://gist.github.com/pacojp/5703761/raw
# nohup /bin/bash /tmp/init_ec2.sh > /tmp/init_ec2.sh.log && rm -f /tmp/init_ec2.sh &
#
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
#!/bin/bash
#
# # sample usage
# curl -o /tmp/install_nginx.sh https://gist.github.com/pacojp/5704628/raw
# nohup /bin/bash /tmp/install_nginx.sh > /tmp/install_nginx.sh.log && rm -f /tmp/install_nginx.sh &
#
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
#!/bin/bash
#
# # sample usage
# curl -o /tmp/install_mysql_server.sh https://gist.github.com/pacojp/5707825/raw
# nohup /bin/bash /tmp/install_mysql_server.sh > /tmp/install_mysql_server.sh.log && rm -f /tmp/install_mysql_server.sh &
#
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
#
# for small cache based wordpress service (ex. aws ec2.micro instance)
#
# this is beta version
#
#
# estimated physical memory size for this mysql server
# 200M
#
#!/bin/bash
#
# this script expects user data field set like below.
#
#==========================
#hostname hogehostname
#somekey fugafuga
#==========================
#
#!/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
#
# # sample usage
# curl -o /tmp/install_wordpress.sh https://gist.github.com/pacojp/5721025/raw
# /bin/bash /tmp/install_wordpress.sh ${HOSTNAME}
#
WORDPRESS_VERSION=3.5.1
# init_ec2.sh
curl -o /tmp/init_ec2.sh https://gist.github.com/pacojp/5703761/raw
nohup /bin/bash /tmp/init_ec2.sh > /tmp/init_ec2.sh.log && rm -f /tmp/init_ec2.sh &
# install_nginx.sh
curl -o /tmp/install_nginx.sh https://gist.github.com/pacojp/5704628/raw
nohup /bin/bash /tmp/install_nginx.sh > /tmp/install_nginx.sh.log && rm -f /tmp/install_nginx.sh &
# install_mysql_server.sh
curl -o /tmp/install_mysql_server.sh https://gist.github.com/pacojp/5707825/raw
user nginx;
worker_processes 3;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
upstream backend {
server unix:/var/run/nginx-backend.sock;
}
# inner reverse proxy(for cache)
server {
listen 3000;
#server_name www.example.com;
server_name _;
root /var/www/example.com/public_html;