サーバー初期化用のスクリプト
yum install -y wget && wget "https://raw.github.com/m-s-modified/Installer/master/cent.sh" -O /tmp/cent.sh && sh /tmp/cent.sh
公開鍵を追加
curl https://github.com/m-s-modified.keys >> ~/.ssh/authorized_keys
wget "https://raw.github.com/m-s-modified/Installer/master/apache.sh" -O /tmp/apache.sh && sh /tmp/apache.sh
作業ユーザーの追加
useradd -g apache $USERNAME
passwd $USERNAME
echo "umask 002" >> /home/$USERNAME/.bashrc
ln -s /var/www/$DOMAIN_NAME/public/ /home/$USERNAME/public
chown $USERNAME:$USERNAME /home/$USERNAME/public
vi /etc/ssh/sshd_config
# Subsystem sftp /usr/libexec/openssh/sftp-server –u 002
Subsystem sftp internal-sftp -u 0002
/etc/init.d/sshd restart
wget "https://raw.github.com/m-s-modified/Installer/master/vhost.sh" -O /tmp/vhost.sh && sh /tmp/vhost.sh
# 簡易版
wget "https://raw.github.com/m-s-modified/Installer/master/vhost.light.sh" -O vhost.light.sh
wget "https://raw.github.com/m-s-modified/Installer/master/deflate.sh" -O /tmp/deflate.sh && sh /tmp/deflate.sh
wget "https://raw.github.com/m-s-modified/Installer/master/ltsv.sh" -O /tmp/ltsv.sh && sh /tmp/ltsv.sh
vi /etc/httpd/conf.d/ltsv.conf
wget "https://raw.github.com/m-s-modified/Installer/master/mysql.sh" -O /tmp/mysql.sh && sh /tmp/mysql.sh
初期設定
mysql_secure_installation
wget "https://raw.github.com/m-s-modified/Installer/master/mysql_user.sh" -O /tmp/mysql_user.sh && sh /tmp/mysql_user.sh
wget "https://raw.github.com/m-s-modified/Installer/master/php.sh" -O /tmp/php.sh && sh /tmp/php.sh
sudo wget https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O /usr/bin/wp
sudo chmod +x /usr/bin/wp
cd DOCUMENT_ROOT
wp core download --locale=ja
wp core config \
--dbhost=$DBHOST \
--dbname=$DBNAME \
--dbuser=$DBUSER \
--dbpass=$DBPASS
wp core install \
--url=$SITE_DOMAIN \
--title=$SITE_TITLE \
--admin_name=$ADMIN_NAME \
--admin_email=admin@example.com \
--admin_password=password
wp-config.php に追記
define('FS_METHOD', 'direct');
wp-config.php に追記
define('FS_CHMOD_DIR', 0775);
define('FS_CHMOD_FILE', 0664);
wget "https://raw.github.com/m-s-modified/Installer/master/chroot.sh" -O /tmp/chroot.sh && sh /tmp/chroot.sh
wget "https://raw.github.com/m-s-modified/Installer/master/memcached.sh" -O /tmp/memcached.sh && sh /tmp/memcached.sh
パスワードによるログインを許可
sed -i -e 's#PasswordAuthentication no#PasswordAuthentication yes#g' /etc/ssh/sshd_config
/etc/init.d/sshd restart
TimeZone 変更
sudo cp /usr/share/zoneinfo/Japan /etc/localtime
HealthCheck
cat << EOS > /etc/httpd/conf.d/healthcheck.conf
Alias /healthcheck /var/www/healthcheck
EOS
mkdir /var/www/healthcheck
cat << EOS > /var/www/healthcheck/index.php
<?php
echo "success";
?>
EOS
.htaccess
SetEnvIf X-Forwarded-For "xxx.xxx.xxx.xxx" allowedip
Allow from env=allowedip
yum --enablerepo=remi install phpMyAdmin
config
vi /etc/httpd/cond.d/phpMyAdmin.conf
# アクセス制限を調整
yum --enablerepo=epel -y install nginx
/etc/init.d/nginx start
chkconfig nginx on
chkconfig --list
http://qiita.com/kidachi_/items/985efebba639713c562e
wget "https://raw.github.com/m-s-modified/Installer/master/ftp.sh" -O /tmp/ftp.sh && sh /tmp/ftp.sh
cd /usr/local/src/
wget http://www.cirt.net/nikto/nikto-current.tar.gz
tar zxvf nikto-current.tar.gz
cd nikto-2.1.5
perl nikto.pl -update
# Run
perl nikto.pl -host http://localhost