打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
LAMP安装全过程_ritto_v3.0
#/bin/bash
#System Configuration Steps:
#Created by ritto.zhao
#MSN:
ritto.zhao@ewizchina.com
#12.15.2008 学习笔记
#Kernel 2.6+、CentOS 5.2
#Change gateway
sed -i 's#GATEWAY=192.168.4.1#GATEWAY=192.168.4.3#' /etc/sysconfig/network
/etc/init.d/network restart
#Disable IPv6
cp /etc/modprobe.conf /etc/modprobe.conf.bak
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
#Disable selinux
cp /etc/sysconfig/selinux /etc/sysconfig/selinux.bak
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/sysconfig/selinux
#Set system time
yum -y install ntp
/usr/sbin/ntpdate cn.pool.ntp.org
#/usr/sbin/ntpdate 210.72.145.44 && clock -w
echo "/usr/sbin/ntpdate cn.pool.ntp.org && clock -w" >> /etc/rc.local
#Stop unuseful services
chkconfig --list | grep 3:on | awk '{print $1}' | egrep -v 'sshd|network|syslog' | xargs -i{} chkconfig --level 3 {} off
chkconfig --list | grep 3:on | cut -f1
reboot
-------------------------------------------------------------
#Load cdrom
mount /dev/cdrom /media
#Set yum source use local cdrom
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
mv CentOS-Media.repo CentOS-Media.repo.bak
vi dvdiso.repo
[DVDISO]
name=DVD ISO
baseurl=file:///media/
enable=1
gpgcheck=0
-------------------------------------------------------------
#Yum source in internet
cd /etc/yum.repos.d
mv CentOS-Base.repo  CentOS-Base.repo.bak
wget
http://centos.ustc.edu.cn/CentOS-Base.repo.5
mv CentOS-Base.repo.5 CentOS-Base.repo
#package install
#new package install_ritto_20081119
yum -y install gcc gcc-c++ flex bison autoconf automake \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \
zlib zlib-devel bzip2 bzip2-devel libxml2 libxml2-devel \
glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel \
curl curl-devel libtiff libtiff-devel pam pam-devel libtool libtool-devel \
e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel \
apr-util apr-util-devel gdbm gdbm-devel openssl openssl-devel
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12
./configure --prefix=/usr/local
make
make install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/
cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cp /usr/local/lib/libmcrypt.* /usr/lib
cd ../../
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9/
./configure
make
make install
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
cd ../
tar zxvf mcrypt-2.6.7.tar.gz
cd mcrypt-2.6.7/
./configure
make
make install
cd ../
tar zxvf cronolog-1.6.2.tar.gz
cd cronolog-1.6.2
./configure --prefix=/usr/local/cronolog
make
make install
cd ../
-------------------------------------------------------------------------------
#MySQL 5.1.30 Installation:
yum -y remove mysql       //删除系统自带的数据库
userdel -r mysql
mkdir /data
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql -s /sbin/nologin -d /data/mysql mysql
mkdir /data/mysql/data
mkdir /data/mysql/logs
chmod -R 755 /data/mysql
chown -R mysql:mysql /data/mysql
tar zxvf mysql-5.1.30.tar.gz
cd mysql-5.1.30/
./configure \
--prefix=/usr/local/mysql/ \
--enable-assembler \              //Use assembler versions of some string functions if available
--with-extra-charsets=complex \
--enable-thread-safe-client \     //Compile the client without threads
--with-big-tables \               //Support tables with more than 4 G rows even on 32bit platforms
--with-readline \
--with-ssl \
--with-embedded-server \          //Build the embedded server (libmysqld)
--enable-local-infile             //Enable LOAD DATA LOCAL INFILE (default: disabled)
------------------------------------------------------------------
./configure --prefix=/usr/local/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile
------------------------------------------------------------------
make
make install
chown -R mysql:mysql /usr/local/mysql
cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
vi /usr/local/mysql/my.cnf
# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
user            = mysql
basedir         = /usr/local/mysql
datadir         = /data/mysql/data
pid-file        = /data/mysql/ritto.pid
log-error       = /data/mysql/logs/ritto-error.log
log-bin         = /data/mysql/logs/ritto-bin.bin
log-output = FILE
#skip-federated
#log-bin=mysql-bin
/usr/local/mysql/bin/mysql_install_db --defaults-file=/usr/local/mysql/my.cnf
#Boot Mysql
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
echo "/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &" >> /etc/rc.d/rc.local
#Stop Mysql
/usr/local/mysql/bin/mysqladmin -uroot -p123456 shutdown
#Change mysql root password
/usr/local/mysql/bin/mysqladmin -u root -p password 123456
/usr/local/mysql/bin/mysql -uroot -e "set password for
[email=root@'localhost'=password('123456');flush]root@'localhost'=password('123456');flush[/email]
privileges;"
#Set mysql of system services
cp /home/ritto/mysql-5.1.30/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
#Set mysql path with system path
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
#Mysql Shell
------------------------------------------------
#!/bin/sh
#Mysql start|stop|restart
#Created by ritto
#20081120
mysql_port=$2
mysql_username="root"
mysql_password="40glab"
mysql_port="3306"
function_start_mysql()
{
   printf "Starting MySQL......\n"
   /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf 2>&1 > /dev/null &
}
function_stop_mysql()
{
   printf "Stoping MySQL......\n"
   /usr/local/mysql/bin/mysqladmin -u${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
}
function_restart_mysql()
{
   printf "Restarting MySQL......\n"
   function_stop_mysql
   function_start_mysql
}
function_open_mysql()
{
   /usr/local/mysql/bin/mysql -u${mysql_username} -p${mysql_password}
}
if [ "$1" = "start" ]; then
   function_start_mysql
elif [ "$1" = "stop" ]; then
   function_stop_mysql
elif [ "$1" = "restart" ]; then
   function_restart_mysql
elif [ "$1" = "open" ]; then
   function_open_mysql
else
   printf "Usage: mysql.sh {start|stop|restart|open}\n"
fi
----------------------------------------------------
chmod +x mysq.sh
mysql.sh start 3306
mysql.sh stop 3306
mysql.sh restart 3306
mysql.sh open 3306
-------------------------------------------------------------------------
Apache 2.2.10的安装方法:
不推荐使用MPM的运行方式用在生产环境下,使用prefork MPM
--with-mpm=worker 或 --with-mpm=perchild
yum -y remove httpd
rum -y remove php-common
tar xvf gd-2.0.36RC1.tar
cd gd-2.0.36RC1
./configure
make
make install
cd ../
tar zxvf httpd-2.2.10.tar.gz
cd httpd-2.2.10
"./configure --prefix=/usr/local/apache2" \
"--enable-so" \           //DSO capability
"--enable-usertrack" \    //user-session tracking
"--enable-ssl" \          //SSL、TLS support(mod_ssl)
"--enable-info" \         //server information
"--enable-cgi" \          //CGI scripts
"--enable-static-ab" \    //Build a statically linked version of ab
"--enable-speling" \      //correct common URL misspellings
"--enable-rewrite" \      //rule based URL manipulation
"--enable-deflate" \      //Deflate transfer encoding support
"--enable-mods-shared=all" \   //Space-separated list of shared modules to enable |"all" | "most"
"--enable-cache" \        //dynamic file caching
"--enable-file-cache" \   //File cache
"--enable-mem-cache" \    //memory caching module
"--enable-disk-cache" \   //disk caching module
"--enable-mime-magic" \   //automagically determining MIME type
"--enable-proxy"  \       //Apache proxy module
-------------------------------------------------------------------------
./configure --prefix=/usr/local/apache2 --enable-so --enable-usertrack --enable-ssl --enable-info --enable-cgi  --enable-speling --enable-rewrite --enable-deflate --enable-mods-shared=all --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-mime-magic --enable-static-ab --enable-proxy
-------------------------------------------------------------------------
make
make install
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local
cd ../
---------------------------------------------------------------------------
php 5.2.8的安装方法:
tar zxvf php-5.2.6.tar.gz
cd php-5.2.6.tar.gz
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \     //Build shared Apache 2.0 Handler module[apxs]
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-config-file-path=/usr/local/php/etc \
--with-libxml-dir=/usr \    //LIBXML: libxml2 install prefix
--with-openssl \            //Include OpenSSL support(requires OpenSSL>=0.9.6)
--with-zlib \               //Include ZLIB support(requires zlib>=1.0.9)
--with-bz2 \                //Include BZip2 support
--with-curl \               //Include cURL support
--with-curlwrappers \       //Use cURL for url streams
--enable-dba \              //Build DBA with bundled modules
--with-gdbm \               //DBA: GDBM support  qdbm gdbm ndbm
--with-gd \                 //Include GD support
--with-jpeg-dir \           //GD: Set the path to libjpeg install prefix
--with-png-dir \            //GD: Set the path to libpng install prefix
--with-zlib-dir \           //GD: Set the path to libz install prefix
--with-ldap \               //Include LDAP support
--with-ttf \                //GD: Include FreeType 1.x support
--with-mcrypt \             //Include mcrypt support
--with-freetype-dir \       //GD: Set the path to FreeType 2 install prefix
--with-iconv-dir=/usr/local \   //Exclude iconv support
--enable-gd-native-ttf \    //GD: Enable TrueType string function
--enable-mbstring \         //Enable multibyte string support
--enable-exif \             //Enable EXIF (metadata from images) support
--enable-ftp \              //Enable FTP support
--enable-wddx               //Enable WDDX support
--enable-shared \           //Build share libraries [default=yes]
--enable-safe-mode \        //Enable safe mode by default
--enable-magic-quotes       //Enable magic quotes by default
--enable-calendar \         //Enable support for calendar conversion
--disable-ipv6 \            //Disable IPv6 support
--enable-bcmath \           //Enable bc style precision math functions
--enable-xml \
--with-mhash \              //Include mhash support
--enable-inline-optimization \
--enable-shmop \            //Enable shmop support
--------------------------------------------------------------------------
./configure \
--prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php/etc --with-libxml-dir=/usr --with-openssl --with-zlib --with-bz2 --with-curl --with-curlwrappers --enable-dba --with-gdbm --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-ldap --with-ttf --with-mcrypt --with-freetype-dir --with-iconv-dir=/usr/local --enable-gd-native-ttf --enable-mbstring --enable-exif --enable-ftp --enable-wddx --enable-shared --enable-safe-mode --enable-magic-quotes --enable-calendar --disable-ipv6 --enable-bcmath --enable-xml --with-mhash --enable-inline-optimization --enable-shmop
---------------------------------------------------------------------------
sed -i 's#-lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt#& -liconv#' Makefile
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
/*如果要改变php的安装选项,只需重新执行前三步即可。再重启apache
/*如果没有使用别的方法,make install将会安装pear.
vi /usr/local/apache/conf/httpd.conf
Add this for PHP5:
LoadModule php5_module        modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
---------------------------------------------------------------------------
#Install Zend Optimizer
tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd ZendOptimizer-3.3.3-linux-glibc23-i386
./install.sh
输入zend optimizer的安装路径 /usr/local/Zend
输入php.ini的安装路径        /usr/local/php/etc
输入apache的安装路径         /usr/local/apache/conf
安装完成后查看phpinfo信息如下:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
Configuration File (php.ini) Path:  /usr/local/php/etc
Loaded Configuration File:          /usr/local/Zend/etc/php.ini
---------------------------------------------------------------------------
#Install eaccelerator
#eaccelerator是PHP的加速软件,使用后PHP的执行效率会有较大幅度的提升
wget
http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
#设置php所在的路径
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519     //输出内容
./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
make install
#安装完成后,屏幕会显示出 eaccelerator.so所在的路径
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
cd ../
#建立缓存目录
mkdir /usr/local/eaccelerator_cache
chmod 0777 /usr/local/eaccelerator_cache
#eaccelerator即可以安装为PHP扩展,也可以安装成Zend扩展,以下是安装成Zend扩展
#安装php扩展则修改 vi /usr/local/php/etc/php.ini
#下面代码要放在[Zend]之前
#vi /usr/local/php/etc/php.ini
cp /usr/local/Zend/etc/php.ini /usr/local/Zend/etc/php.ini.bak
vi /usr/local/Zend/etc/php.ini
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/usr/local/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
------------------------------------------------------------------
#Install PDO_MySQL
wget
http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
./configure --with-php-config=$PHP_PREFIX/bin/php-config --with-pdo-mysql=/usr/local/mysql
make
make install
cd ../
-------------------------------------------------------------------
#Install memcache
#memcached是一个高性能的分布式内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表
#它能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等
wget
http://pecl.php.net/get/memcache-2.2.4.tgz
tar zxvf memcache-2.2.4.tgz
cd memcache-2.2.4/
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
./configure --with-php-config=$PHP_PREFIX/bin/php-config
make
make install
cd ../
#vi /usr/local/php/etc/php.ini
vi /usr/local/Zend/etc/php.ini
手动修改:
    查找/usr/local/php/etc/php.ini中的extension_dir = "./"
  修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
  并在此行后增加以下几行,然后保存:
  extension = "memcache.so"
  extension = "pdo_mysql.so"
  再查找output_buffering = Off
  修改为output_buffering = On
自动修改:
sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so"\nextension = "pdo_mysql.so"\n#' /usr/local/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
-----------------------------------------------------------------
# php.ini 优化
vi /usr/local/Zend/etc/php.ini
#post_max_size = 8M
post_max_size = 30M
#upload_max_filesize = 2M     //修改上传文件的限制
upload_max_filesize = 25M
#自动修改
sed -i 's/post_max_size = 8M/ post_max_size = 30M/g' /usr/local/Zend/etc/php.ini
sed -i 's/upload_max_filesize = 2M/ upload_max_filesize = 25M/g' /usr/local/Zend/etc/php.ini
sed -i '/expose_php/s/On/Off/' /usr/local/php/etc/php.ini
sed -i '/display_errors/s/On/Off/' /usr/local/php/etc/php.ini
-----------------------------------------------------------------
#创建apache启动脚本
vi /etc/init.d/httpd
*****************************************************************
#!/bin/bash
#
# Startup script for the Apache Web Server
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.   It is used to serve \
#               HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
pid=/usr/local/apache2/logs/httpd.pid
prog=httpd
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.   So we just do it the way init scripts
# are expected to behave here.
start() {
         echo -n $"Starting $prog: "
        daemon $httpd $OPTIONS
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
        return $RETVAL
}
stop() {
         echo -n $"Stopping $prog: "
        killproc $httpd
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd $pid
}
reload() {
         echo -n $"Reloading $prog: "
        killproc $httpd -HUP
         RETVAL=$?
         echo
}
# See how we were called.
case "$1" in
   start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $httpd
         RETVAL=$?
         ;;
  restart)
        stop
         start
        ;;
  condrestart)
         if [ -f $pid ] ; then
                 stop
                 start
         fi
        ;;
  reload)
        reload
        ;;
  graceful|help|configtest|fullstatus)
        $apachectl $@
        RETVAL=$?
         ;;
   *)
         echo $"Usage: $prog {start|stop|restart|condrestart|reload|status"
        echo $"|fullstatus|graceful|help|configtest}"
        exit 1
esac
exit $RETVAL
********************************************************************
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 3 httpd on
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
#配置apache虚拟主机
groupadd web
adduser -g web -s /sbin/nologin web
mkdir /data/web
mkdir /data/web/vhost/linux.mm.cn
mkdir /data/web/vhost/shop.mm.cn
mkdir /data/web/logs
chown -R web.web /data/web
chmod -R 755 /data/web
cp /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/httpd.conf.bak
*******************************************************************
vi /usr/local/apache2/conf/httpd.conf
#-------------------------------------------------------------
# ritto.zhao 12.29.2008
#-------------------------------------------------------------
ServerRoot "/usr/local/apache2"
ServerAdmin
ritto.zhao@xxx.com
Listen 80
Listen 443
User web
Group web
ServerName 192.168.4.227:80
DocumentRoot "/data/web"
LoadModule php5_module        modules/libphp5.so
AddType     application/x-httpd-php         .php .php3 .phtml
AddType     application/x-httpd-php-source  .phps
AddHandler  cgi-script       .cgi .pl
DirectoryIndex index.php index.html index.htm home.html home.htm
#------------------------------------------------------------
# extra/httpd-default.conf
#------------------------------------------------------------
Timeout 15
KeepAlive Off
MaxKeepAliveRequests 50
KeepAliveTimeout 5
UseCanonicalName Off
AccessFileName .htaccess
ServerTokens Full
ServerSignature On
HostnameLookups Off
#------------------------------------------------------------
# extra/httpd-mpm.conf
#------------------------------------------------------------
PidFile "/data/web/httpd.pid"
    StartServers          10
    MinSpareServers       10
    MaxSpareServers       15
    ServerLimit           2000
    MaxClients            2000
    MaxRequestsPerChild   10000
#---------------------------------------------------------------------
# 'Main' server configuration
#---------------------------------------------------------------------
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
DefaultType text/plain
TypesConfig /usr/local/apache2/conf/mime.types
MIMEMagicFile /usr/local/apache2/conf/magic
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
#AddType application/x-tar .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
AccessFileName .htaccess
    Order allow,deny
    Deny from all
    Satisfy All
    # Redirect permanent /foo
http://www.example.com/bar
    # Alias /webpath /full/filesystem/path
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
ErrorLog "/usr/local/apache2/logs/error_log.all"
#CustomLog "/usr/local/apache2/logs/access_log.all" combined
CustomLog "|/usr/local/cronolog/sbin/cronolog /usr/local/apache2/logs/access_log.all.%Y-%m-%d" combined
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402
http://www.example.com/subscription_info.html
#-----------------------------------------------------------------
# extra/httpd-autoindex.conf
#-----------------------------------------------------------------
Alias /icons/ "/usr/local/apache2/icons/"
    Options         Indexes MultiViews
    AllowOverride   None
    Order allow,deny
    Allow from all
IndexOptions FancyIndexing HTMLTable VersionSort
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
DefaultIcon /icons/unknown.gif
#AddDescription "GZIP compressed document" .gz
#AddDescription "tar archive" .tar
#AddDescription "GZIP compressed tar archive" .tgz
ReadmeName README.html
HeaderName HEADER.html
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
#-----------------------------------------------------------------
# extra/httpd-autoindex.conf
#-----------------------------------------------------------------
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
Include /usr/local/apache2/conf/extra/httpd-languages.conf
#-----------------------------------------------------------------
# httpd-vhost
#-----------------------------------------------------------------
    AllowOverride AuthConfig Limit FileInfo Indexes
    Options Indexes FollowSymlinks ExecCGI
    Order allow,deny
    Allow from all
   
        Order allow,deny
        Allow from all
   
   
        Order deny,allow
        Deny from all
   
NameVirtualhost 192.168.4.227:80
#
    ServerAdmin   
ritto.zhao@xxx.com
    ServerName    default.mm.cn
    ServerAlias   
www.mm.cn
    ScriptAlias   /cgi-bin/ /usr/local/apache2/cgi-bin/
#   Alias         /img/ /data/web/img/
    DocumentRoot "/data/web/vhost/default.mm.cn"
    ErrorLog "/data/web/logs/default.mm.cn-error_log"
    CustomLog "|/usr/local/cronolog/sbin/cronolog /data/web/logs/default.mm.cn-access_log.%Y-%m-%d" combined
#
    ServerAdmin
ritto.zhao@xxx.com
    ServerName linux.mm.cn
    ServerAlias windows.mm.cn
    DocumentRoot "/data/web/vhost/linux.mm.cn"
    ErrorLog "/data/web/logs/linux.mm.cn-error_log"
    CustomLog "|/usr/local/cronolog/sbin/cronolog /data/web/logs/linux.mm.cn-access_log.%Y-%m-%d" combined
# CustomLog "logs/dummy-host.example.com-access_log" common
#
    ServerAdmin
ritto.zhao@xxx.com
    ServerName shop.mm.cn
    ServerAlias *.shop.mm.cn
    DocumentRoot "/data/web/vhost/shop.mm.cn"
    ErrorLog "/data/web/logs/shop.mm.cn-error_log"
    CustomLog "|/usr/local/cronolog/sbin/cronolog /data/web/logs/shop.mm.cn-access_log.%Y-%m-%d" combined
# CustomLog "logs/dummy-host.example.com-access_log" common
### SSL ##########################################################
#
    ServerAdmin
ritto.zhao@xxx.com
    ServerName ssl.mm.cn
    DocumentRoot "/data/web/vhost/ssl.mm.cn"
    ErrorLog "/data/web/logs/ssl.mm.cn-error_log"
    CustomLog "|/usr/local/cronolog/sbin/cronolog /data/web/logs/ssl.mm.cn-access_log.%Y-%m-%d" combined
    SSLEngine on
    SSLCertificateFile "/usr/local/apache2/conf/keys/server.crt"
    SSLCertificateKeyFile "/usr/local/apache2/conf/keys/server.key"
### phpMyadmin #################################
Alias /phpmyadmin /data/web/phpmyadmin
    Options Indexes FollowSymlinks
    AllowOverride None
    Order allow,deny
    Allow from all
#--------------------------------------------------------------
# Default LoadModule
#--------------------------------------------------------------
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule log_forensic_module modules/mod_log_forensic.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule ident_module modules/mod_ident.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
#-----------------------------------------------------------------
# extra/httpd-info.conf
#-----------------------------------------------------------------
Alias /server-status "/data/web/vhost/linux.mm.cn/server-status"
Alias /server-info "/data/web/vhost/linux.mm.cn/server-info"
    SetHandler server-status
    Order allow,deny
    Allow from all
    SetHandler server-info
    Order allow,deny
    Allow from all

#最大请求连接数
ps -ef | grep httpd | wc -l
#查看现在的连接数,用
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
#服务器内存,CPU大小.以及使用率.
ps -ef | grep 80 | grep ESTAB | wc -l
----------------------------------------------------------------------------------
#phpMyadmin installation
tar zxvf phpMyAdmin-2.11.8.1-all-languages-utf-8-only.tar.gz
cd phpMyAdmin-2.11.8.1-all-languages-utf-8-only
cp -r phpMyAdmin-2.11.8.1-all-languages-utf-8-only /data/web/phpmyadmin
chown -R web.web /data/web/phpmyadmin/
chmod -R 755 /data/web/phpmyadmin/
cd /data/web/phpmyadmin
vi /usr/local/apache2/conf/httpd.conf
Alias /phpmyadmin /data/web/phpmyadmin
    AllowOverride None
    Options Indexes FollowSymlinks
    Order allow,deny
    Allow from all
cd /data/web/phpmyadmin/libraries
vi config.default.php
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['password'] = '123456';
$cfg['blowfish_secret'] = 'www.mm.cn';
-----------------------------------------------------------------------------
# Https
cd /usr/local/apache2/conf/
mkdir keys
cd keys
openssl genrsa -des3 -out server.key 4096
#建立服务器公钥
openssl req -new -key server.key -out server.csr
#建立服务器证书
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
#从密钥中删除密码
openssl rsa -in server.key -out server.key.insecure
#将原有的server.key改名保存,将删除密码的密钥改名为server.key
mv server.key server.key.secure
mv server.key.insecure server.key
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
#设置SSL虚拟主机
Listen 443
    ServerAdmin
ritto.zhao@xxx.com
    ServerName ssl.mm.cn
    DocumentRoot "/data/web/vhost/ssl.mm.cn"
    ErrorLog "/data/web/logs/ssl.mm.cn-error_log"
    CustomLog "|/usr/local/cronolog/sbin/cronolog /data/web/logs/ssl.mm.cn-access_log.%Y-%m-%d" combined
    SSLEngine on
    SSLCertificateFile "/usr/local/apache2/conf/keys/server.crt"
    SSLCertificateKeyFile "/usr/local/apache2/conf/keys/server.key"
Usage:
http://ssl.mm.cn
--------------------------------------------------------------------------------------
#为虚拟主机用户设置FTP (vsftpd)
yum -y install vsftpd
adduser -g web -d /data/web/vhost/linux.mm.cn -s /sbin/nologin linux.mm.cn
passwd linux.mm.cn
chown -R linux.mm.cn:web /data/web/vhost/linux.mm.cn/
chmod -R 775 /data/web/vhost/linux.mm.cn/

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
在Ubuntu Server上编译安装 Apache 2.2(with SSL) PHP 5.1.4 MYSQL 5.0.22
apache整合php编译安装配置(LAMP)
FreeBSD6_Apache2+ MySql5+ PHP5等安装集合【非ports】
Linux+Apache+Mysql+PHP典型配置(3)
subversion 1.2.3 for Redhat linux AS 4 源码包安装文档
apache的源码安装详细过程全纪录
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服