Last active
August 29, 2015 14:14
-
-
Save nakamura-akifumi/5a810c5cb2a6191181ee to your computer and use it in GitHub Desktop.
nginx と zabbixインストール
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "start script" | |
echo "step 1: install nginx" | |
cat << 'EOL' >> /etc/yum.repos.d/nginx.repo | |
[nginx] | |
name=nginx repo | |
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ | |
gpgcheck=0 | |
enabled=1 | |
EOL | |
yum install -y nginx php-fpm | |
echo "step 2: install zabbix" | |
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm | |
yum -y install zabbix-server-pgsql zabbix-web-pgsql zabbix-web-japanese | |
yum -y install zabbix-agent | |
yum -y install zabbix-get | |
chkconfig zabbix-server on | |
chkconfig zabbix-agent on | |
service zabbix-server start | |
service zabbix-agent start | |
sed -i "s/^\(enabled=\)1/\10/g" /etc/yum.repos.d/zabbix.repo | |
echo "step 3: update configuration (php-fpm, php, nginx)" | |
# /etc/nginx/conf.d/zabbix.conf | |
cat << 'EOL' >> /etc/nginx/conf.d/zabbix.conf | |
server { | |
server_name zabbix.example.org; | |
root /var/www/zabbix; | |
index index.html index.php; | |
access_log /var/log/nginx/access_zabbix.log main; | |
error_log /var/log/nginx/error_zabbix.log error; | |
location ~ \.php { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
EOL | |
# /etc/php.ini | |
sed -i "s/^max_execution_time = 30/max_execution_time = 300/g" /etc/php.ini | |
sed -i "s/^max_input_time = 60/max_input_time = 300/g" /etc/php.ini | |
sed -i "s/^post_max_size = 8M/;post_max_size = 32M/g" /etc/php.ini | |
sed -i "s/^;date\.timezone =/date\.timezone = Asia\/Tokyo/g" /etc/php.ini | |
sed -i "s/^;post_max_size = 32M/post_max_size = 16M/g" /etc/php.ini | |
# /etc/php-fpm.d/www.conf | |
sed -i "s/^user = apache/user = nginx/g" /etc/php-fpm.d/www.conf | |
sed -i "s/^group = apache/group = nginx/g" /etc/php-fpm.d/www.conf | |
chkconfig php-fpm on | |
service php-fpm start | |
# create symbolic link | |
cd /etc/zabbix | |
ls -ld web | |
chown nginx.nginx web | |
cd /var/www | |
ln -s /usr/share/zabbix . | |
chkconfig nginx on | |
service nginx start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment