I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.
if ufw is not installed by default be sure to install it first.
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential git-core curl libssl-dev \ | |
libreadline5 libreadline5-dev \ | |
zlib1g zlib1g-dev \ | |
libmysqlclient-dev \ | |
libcurl4-openssl-dev \ | |
libxslt-dev libxml2-dev |
# | |
# Run as root | |
# $ bash <(curl -s https://raw.github.com/gist/1631411) | |
# | |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential git-core curl \ | |
libssl-dev \ |
[mysqld] | |
init_connect='SET collation_connection = utf8mb4_unicode_ci' | |
init_connect='SET NAMES utf8mb4' | |
character-set-server = utf8mb4 | |
character-set-client = utf8mb4 | |
collation-server = utf8mb4_unicode_ci | |
skip-character-set-client-handshake | |
innodb_file_format = Barracuda |
wget http://hackmysql.com/scripts/mysqlsla | |
chmod +x mysqlsla-2.03 | |
sudo ./mysqlsla-2.03 /var/log/mysql/mysql-slow.log | |
# 預設會列出 top 10 的 slow quires | |
# 可以帶參數 --top 13 修改列出的項目數量 | |
# 通常網路上都說從 top 1, 2, 3 的 slow quires 去修 | |
# 是對增進效能最有幫助的! |
# redirect http to https | |
set $redirect ""; | |
if ($http_x_forwarded_proto != 'https') { | |
set $redirect "1"; | |
} | |
if ($http_user_agent !~* ELB-HealthChecker) { | |
set $redirect "${redirect}1"; | |
} | |
if ($http_host ~ "your-nifty-domain.com") { | |
set $redirect "${redirect}1"; |
apt-get -y install vim byobu terminator htop tree | |
apt-get -y install git-core curl mysql-server libmysqlclient-dev libcurl4-openssl-dev | |
--- | |
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
--- | |
apt-get -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev |
#!/bin/bash | |
threshold=80 # percent | |
total=$(free | grep "Mem:" | awk '{print $2}') | |
remaining=$(free | grep "buffers" | awk '{print $4}' | tail -n 1) | |
current=$(echo "scale=0;100-$remaining * 100 / $total" | bc -l) | |
if [ $current -gt $threshold ] | |
then | |
/etc/init.d/httpd stop |
Passenger Standalone with Nginx | |
----- | |
command | |
passenger start -S /tmp/s.dev.socket -d | |
nginx config example | |
upstream s_dev_server { |
#!/bin/sh | |
# | |
# An example hook script for the "post-receive" event. | |
# | |
# The "post-receive" script is run after receive-pack has accepted a pack | |
# and the repository has been updated. It is passed arguments in through | |
# stdin in the form | |
# <oldrev> <newrev> <refname> | |
# For example: | |
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master |