Skip to content

Instantly share code, notes, and snippets.

@piwik-la
piwik-la / auto_restart_webserver.sh
Created February 12, 2016 14:43 — forked from xi4oh4o/auto_restart_webserver.sh
Auto restart phpfpm on 502 & 504 Error also save logs
#!/bin/bash
MY_URL="http://moefou.org" #change you website
RESULT_502=`curl -I $MY_URL|grep "HTTP/1.1 502"`
RESULT_504=`curl -I $MY_URL|grep "HTTP/1.1 504"`
if [ -n "$RESULT_502" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "502 Bad Gateway">>/data/logs/web_error.log
elif [ -n "$RESULT_504" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "504 Gateway Time-out">>/data/logs/web_error.log
@piwik-la
piwik-la / yum nginx
Created October 27, 2014 16:06
install nginx on centos
yum -y install gcc gcc-c++ make zlib-devel pcre-devel openssl-devel wget
mkdir -p src && cd src
nginxVersion="1.7.6"
wget http://nginx.org/download/nginx-$nginxVersion.tar.gz
tar -xzf nginx-$nginxVersion.tar.gz
ln -sf nginx-$nginxVersion nginx
cd nginx
./configure \
--user=nginx \
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# 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
# pidfile: /var/run/nginx.pid
sudo yum install httpd
sudo service httpd start
sudo yum install mysql-server
sudo service mysqld start
sudo /usr/bin/mysql_secure_installation
sudo yum install php php-mysql
yum search php-