2013/11/29

建立SSL使用憑證

##建立SSL使用憑證
mkdir -p /ssl/
cd /ssl
openssl genrsa -out privatekey.pem 2048
openssl req -new -key privatekey.pem -out  certerq.csr

openssl x509 -req -days 3650 -in certerq.csr -signkey privatekey.pem -out cert.pem

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out /ssl/apache2/apache.crt -keyout /ssl/apache2/apache.key

shell for Backup

#!/bin/bash
day=`date +%Y-%m-%d-%T`
backupph=/backup/$day
mkdir -p $backupph
cp -a /var/named/chroot/ $backupph
echo "Backup Finish"



------


#!/bin/bash
day=`date +%Y-%m-%d`
backupph=/media/disk/$day
mkdir $backupph
tar -czvfP $backupph/home.tgz /home
echo "Backup Finish"



TAR


tar -xzvPf filename

2013/11/06

Basic Apache 2.4.6 PHP 5.5.4

## Basic

yum install gcc libtool make automake autoconf curl-devel gd-devel openssl-devel gcc-c++ libmcrypt-devel libevent-devel posgresql-devel cronolog libtool-ltdl-devel

## Apache apr

wget http://ftp.twaren.net/Unix/Web/apache//apr/apr-1.4.8.tar.gz

tar xf apr-1.4.8.tar.gz
cd apr-1.4.8
./configure
make ; make install

## Apache apr-util

wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz

tar xf apr-util-1.5.2.tar.gz
cd apr-util-1.5.2
./configure --with-apr=/usr/local/apr/bin/apr-1-config
make ; make install


wget  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.zip
unzip pcre-8.33.zip
cd pcre-8.33
./configure
make ; make install

## Apache

wget http://archive.apache.org/dist/httpd/httpd-2.4.6.tar.gz
tar xf httpd-2.4.6.tar.gz
cd httpd-2.4.6
./configure --prefix=/usr/local/apache2
make ; make install

## PHP 5.5.4

yum -y install libxml2 libxml2-devel
wget http://tw2.php.net/get/php-5.5.4.tar.gz/from/this/mirror
tar -xf php-5.5.4.tar.gz
cd php-5.5.4
./configure  --prefix=/usr/local/apache2/php
make ; make install

##
cd /usr/local/bin ; ln -s /usr/local/apache2/php/bin/php ; ln -s /usr/local/apache2/php/bin/phpize ; ln -s /usr/local/apache2/php/bin/php-config

touch /usr/local/apache2/conf/php.ini

##
echo "AddType application/x-httpd-php .php" >> /usr/local/apache2/conf/httpd.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/apache2/conf/httpd.conf