#!/bin/bash # ssh disable password authentication sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config systemctl restart sshd.service # Time zone /bin/cp -p /usr/share/zoneinfo/Japan /etc/localtime echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock echo 'UTC=false' >> /etc/sysconfig/clock # Yum ## Utility yum install -y \ bash-completion \ bind-utils \ lsof \ net-tools \ php php-fpm php-mbstring php-mysql \ screen \ sos \ sysstat ## Editor yum install -y \ vim-enhanced ## Nginx Repository cat << EOF | tee /etc/yum.repos.d/nginx-mainline.repo > /dev/null [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/7/x86_64/ gpgcheck=0 enabled=1 EOF ## Hack for Nginx echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf echo 'net.ipv4.tcp_tw_reuse = 1' >> /etc/sysctl.conf echo 'net.ipv4.tcp_max_syn_backlog = 100000' >> /etc/sysctl.conf echo 'net.netfilter.nf_conntrack_max = 100000' >> /etc/sysctl.conf echo 'net.nf_conntrack_max = 100000' >> /etc/sysctl.conf echo 'fs.file-max = 320000' >> /etc/sysctl.conf sysctl -p ## Install Nginx and AB tools yum install -y nginx httpd-tools ## fpm settings sed -i -e 's/listen = 127.0.0.1:9000/listen = \/var\/run\/php5-fpm.sock/' /etc/php-fpm.d/www.conf sed -i -e 's/user = apache/user = nginx/' /etc/php-fpm.d/www.conf sed -i -e 's/group = apache/group = nginx/' /etc/php-fpm.d/www.conf ## nginx settings sed -i 's/worker_processes 1;/worker_processes auto;/' /etc/nginx/nginx.conf mv /etc/nginx/conf.d/default.conf /tmp/default.conf curl -OL https://raw.githubusercontent.com/kazuhisya/SL-Scripts/master/conf/nginx-wp-default.conf mv nginx-wp-default.conf /etc/nginx/conf.d/default.conf ## Get WordPress curl -OL https://ja.wordpress.org/latest-ja.tar.gz tar -zxvf latest-ja.tar.gz mv wordpress /var/www/ chown -R nginx:nginx /var/www/wordpress ## Service Enable and Start systemctl enable php-fpm.service systemctl start php-fpm.service systemctl enable nginx.service systemctl start nginx.service