成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

CentOS下的LAMP環(huán)境之A.M.P環(huán)境

運維 系統(tǒng)運維
CentOS下的LAMP環(huán)境之A.M.P環(huán)境:LAMP是說Linux-Apache-MySQL-PHP,LAMP網(wǎng)站架構(gòu)是目前國際流行的Web框架。LAMP框架包括:Linux操作系統(tǒng),Apache網(wǎng)絡(luò)服務(wù)器,MySQL數(shù)據(jù)庫,Perl、PHP或者Python編程語言。LAMP所有組成產(chǎn)品均是開源軟件,是國際上成熟的架構(gòu)框架。本文講述的是CentOS下的LAMP環(huán)境之A.M.P環(huán)境。

CentOS下的LAMP環(huán)境之A.M.P環(huán)境(大綱

  三、編譯安裝A.M.P環(huán)境

  1.下載軟件編譯安裝

  1)下載軟件

  1.   # cd /usr/local/src  
  2.  

  httpd-2.2.8.tar.gz

  mysql-5.0.51b.tar.gz

  php-5.2.6.tar.bz2

  ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

  2) 安裝MySQL

  查看分析你的CPU型號:

  查找您的GCC編譯參數(shù).

  確定系統(tǒng)CPU類型:

  1.   # cat /proc/cpuinfo | grep "model name"  
  2.  

  執(zhí)行后會看到系統(tǒng)中CPU的具體型號,記下CPU型號。

  1.   # tar xvf mysql-5.0.51b.tar.gz  
  2.  
  3.   # cd mysql-5.0.51b  
  4.  
  5.   # vi mysql.sh  
  6.  

  代碼:

  1.   -------------------cut begin-------------------------------------------  
  2.  
  3.   CHOST="i686-pc-linux-gnu" 
  4.  
  5.   CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer" 
  6.  
  7.   CXXFLAGS="${CFLAGS}" 
  8.  
  9.   ./configure \  
  10.  
  11.   "--prefix=/usr/local/mysql" \  
  12.  
  13.   "--localstatedir=/data/mysql/data" \  
  14.  
  15.   "--with-comment=Source" \  
  16.  
  17.   "--with-server-suffix=-LinuxTone" \  
  18.  
  19.   "--with-mysqld-user=mysql" \  
  20.  
  21.   "--without-debug" \  
  22.  
  23.   "--with-big-tables" \  
  24.  
  25.   "--with-charset=gbk" \  
  26.  
  27.   "--with-collation=gbk_chinese_ci" \  
  28.  
  29.   "--with-extra-charsets=all" \  
  30.  
  31.   "--with-pthread" \  
  32.  
  33.   "--enable-static" \  
  34.  
  35.   "--enable-thread-safe-client" \  
  36.  
  37.   "--with-client-ldflags=-all-static" \  
  38.  
  39.   "--with-mysqld-ldflags=-all-static" \  
  40.  
  41.   "--enable-assembler" \  
  42.  
  43.   "--without-isam" \  
  44.  
  45.   "--without-innodb" \  
  46.  
  47.   "--without-ndb-debug"  
  48.  
  49.   make && make install  
  50.  
  51.   mkdir -p /data/mysql/data  
  52.  
  53.   useradd mysql -d /data/mysql -s /sbin/nologin  
  54.  
  55.   /usr/local/mysql/bin/mysql_install_db --user=mysql 
  56.  
  57.   cd /usr/local/mysql  
  58.  
  59.   chown -R root:mysql .  
  60.  
  61.   chown -R mysql /data/mysql/data  
  62.  
  63.   cp share/mysql/my-huge.cnf /etc/my.cnf  
  64.  
  65.   cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld  
  66.  
  67.   chmod 755 /etc/rc.d/init.d/mysqld  
  68.  
  69.   chkconfig --add mysqld  
  70.  
  71.   /etc/rc.d/init.d/mysqld start  
  72.  
  73.   cd /usr/local/mysql/bin  
  74.  
  75.   for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done  
  76.  
  77.   -------------------cut end---------------------------------------------  
  78.  

  #sh mysql.sh 即可開始編譯.

  3) 編譯安裝Apache

  1.   # cd /usr/local/src  
  2.  
  3.   # tar xvf httpd-2.2.8.tar.gz  
  4.  
  5.   # cd httpd-2.2.8  
  6.  

  代碼:

  1.   # ./configure \  
  2.  
  3.   "--prefix=/usr/local/apache2" \  
  4.  
  5.   "--with-included-apr" \  
  6.  
  7.   "--enable-so" \  
  8.  
  9.   "--enable-deflate=shared" \  
  10.  
  11.   "--enable-expires=shared" \  
  12.  
  13.   "--enable-rewrite=shared" \  
  14.  
  15.   "--enable-static-support" \  
  16.  
  17.   "--disable-userdir"  
  18.  
  19.   # make  
  20.  
  21.   # make install  
  22.  
  23.   # echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local  
  24.  

  4.)編譯安裝PHP

  1.   # cd /usr/local/src  
  2.  
  3.   # tar xjvf php-5.2.6.tar.bz2  
  4.  
  5.   # cd php-5.2.6  
  6.  

  代碼:

  1.   # ./configure \  
  2.  
  3.   "--prefix=/usr/local/php" \  
  4.  
  5.   "--with-apxs2=/usr/local/apache2/bin/apxs" \  
  6.  
  7.   "--with-config-file-path=/usr/local/php/etc" \  
  8.  
  9.   "--with-mysql=/usr/local/mysql" \  
  10.  
  11.   "--with-libxml-dir=/usr/local/libxml2" \  
  12.  
  13.   "--with-gd=/usr/local/gd2" \  
  14.  
  15.   "--with-jpeg-dir" \  
  16.  
  17.   "--with-png-dir" \  
  18.  
  19.   "--with-bz2" \  
  20.  
  21.   "--with-freetype-dir" \  
  22.  
  23.   "--with-iconv-dir" \  
  24.  
  25.   "--with-zlib-dir " \  
  26.  
  27.   "--with-openssl=/usr/local/openssl" \  
  28.  
  29.   "--with-mcrypt=/usr/local/libmcrypt" \  
  30.  
  31.   "--enable-soap" \  
  32.  
  33.   "--enable-gd-native-ttf" \  
  34.  
  35.   "--enable-ftp" \  
  36.  
  37.   "--enable-mbstring" \  
  38.  
  39.   "--enable-exif" \  
  40.  
  41.   "--disable-ipv6" \  
  42.  
  43.   "--disable-cgi" \  
  44.  
  45.   "--disable-cli" #禁掉ipv6,禁掉cli模式,提升速度和安全性.請根據(jù)具體需求定制相關(guān)的編譯數(shù).  
  46.  
  47.   # make  
  48.  
  49.   # make install  
  50.  
  51.   # mkdir /usr/local/php/etc  
  52.  
  53.   # cp php.ini-dist /usr/local/php/etc/php.ini  
  54.  

  5)Xcache的安裝.

  #tar xvf xcache-1.2.2.tar.gz

  代碼:

  1.   #/usr/local/php/bin/phpize  
  2.  
  3.   ./configure --enable-xcache --enable-xcache-coverager  
  4.  
  5.   --with-php-config=/usr/local/php/bin/php-config \  
  6.  
  7.   --enable-inline-optimization --disable-debug  
  8.  

  代碼:

  1.   #/usr/local/php/bin/phpize  
  2.  
  3.   ./configure --enable-xcache --enable-xcache-coverager  
  4.  
  5.   --with-php-config=/usr/local/php/bin/php-config \  
  6.  
  7.   --enable-inline-optimization --disable-debug  
  8.  

  代碼:

  1.   -------------------cut begin-------------------------------------------  
  2.  
  3.   [xcache-common]  
  4.  
  5.   zend_extension =  
  6.  
  7.   /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so  
  8.  
  9.   [xcache.admin]  
  10.  
  11.   xcache.admin.user = "admin" 
  12.  
  13.   ;如何生成md5密碼: echo -n "password"| md5sum  
  14.  
  15.   xcache.admin.pass = "035d849226a8a10be1a5e0fec1f0f3ce" #密碼為52netseek  
  16.  
  17.   [xcache]  
  18.  
  19.   ; Change xcache.size to tune the size of the opcode cache  
  20.  
  21.   xcache.size = 24M 
  22.  
  23.   xcache.shm_scheme = "mmap" 
  24.  
  25.   xcache.count = 4 
  26.  
  27.   xcache.slots = 8K 
  28.  
  29.   xcache.ttl = 0 
  30.  
  31.   xcache.gc_interval = 0 
  32.  
  33.   ; Change xcache.var_size to adjust the size of variable cache  
  34.  
  35.   xcache.var_size = 8M 
  36.  
  37.   xcache.var_count = 1 
  38.  
  39.   xcache.var_slots = 8K 
  40.  
  41.   xcache.var_ttl = 0 
  42.  
  43.   xcache.var_maxttl = 0 
  44.  
  45.   xcache.var_gc_interval = 300 
  46.  
  47.   xcache.test = Off 
  48.  
  49.   xcache.readonly_protection = On 
  50.  
  51.   xcache.mmap_path = "/tmp/xcache" 
  52.  
  53.   xcache.coredump_directory = "" 
  54.  
  55.   xcache.cacher = On 
  56.  
  57.   xcache.stat = On 
  58.  
  59.   xcache.optimizer = Off 
  60.  
  61.   [xcache.coverager]  
  62.  
  63.   xcache.coverager = On 
  64.  
  65.   xcache.coveragedump_directory = "" 
  66.  
  67.   -------------------cut end---------------------------------------------  
  68.  

  6) 安裝Zend Optimizer

  1.   # cd /usr/local/src  
  2.  
  3.   # tar xzvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz  
  4.  
  5.   # ./ZendOptimizer-3.3.3-linux-glibc23-i386/install.sh  
  6.  

  安裝Zend Optimizer過程的最后不要選擇重啟Apache。

  2. 整合Apache與PHP及系統(tǒng)初化配置.

  1)整合Apache與PHP

  1.   # vi /usr/local/apache2/conf/httpd.conf  
  2.  

  找到:

  AddType application/x-gzip .gz .tgz

  在該行下面添加

  1.   AddType application/x-httpd-php .php  
  2.  

  找到:  

  1.   DirectoryIndex index.html  
  2.  

  將該行改為  

  1.   DirectoryIndex index.html index.htm index.php  

 

  找到:

  1.   #Include conf/extra/httpd-mpm.conf  
  2.  
  3.   #Include conf/extra/httpd-info.conf  
  4.  
  5.   #Include conf/extra/httpd-vhosts.conf (虛擬主機配置文件存放目錄.)  
  6.  
  7.   #Include conf/extra/httpd-default.conf  
  8.  

  去掉前面的“#”號,取消注釋。

  注意:以上 4 個擴展配置文件中的設(shè)置請按照相關(guān)原則進行合理配置!

  修改完成后保存退出。

  1.   # /usr/local/apache2/bin/apachectl restart  
  2.  

  2)查看確認L.A.M.P環(huán)境信息、提升 PHP 安全性

  在網(wǎng)站根目錄放置 info.php 腳本,檢查phpinfo中的各項信息是否正確。

  

  1.   phpinfo();  
  2.  
  3.   ?> 
  4.  

  確認 PHP 能夠正常工作后,在 php.ini 中進行設(shè)置提升 PHP 安全性,禁掉危險的函數(shù).

  # vi /etc/php.ini找到:disable_functions

  =設(shè)置為:phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

  3)腳本自動完成初始化配置(以上配置可以用腳本自動化完成)

  #cat init_apache_php.sh

  代碼:

  1.   -------------------cut begin-------------------------------------------  
  2.  
  3.   #!/bin/bash  
  4.  
  5.   #Written by :NetSeek  
  6.  
  7.   #init_httpd.conf  
  8.  
  9.   http_cf="/usr/local/apache2/conf/httpd.conf" 
  10.  
  11.   sed -i -e "s/User daemon/User www/" -i -e "s/Group daemon/Group www/" $http_cf  
  12.  
  13.   sed -i -e '121 s/^/#/' -i -e '122 s/^/#/' $http_cf  
  14.  
  15.   sed -i 's#DirectoryIndex index.html# DirectoryIndex index.php index.html  
  16.  
  17.   index.htm#/g' $http_cf  
  18.  
  19.   sed -i -e '374 s/^#//g' -i -e '389 s/^#//g' -i -e '392 s/^#//g' -i -e '401  
  20.  
  21.   s/^#//g' $http_cf  
  22.  
  23.   #init_php(PHP安全設(shè)置及隱藏PHP版本)  
  24.  
  25.   php_cf="/usr/local/php/etc/php.ini" 
  26.  
  27.   sed -i '205 s#;open_basedir =#open_basedir = /data/www/wwwroot:/tmp#g' $php_cf  
  28.  
  29.   sed -i '210 s#disable_functions =#disable_functions =  
  30.  
  31.   phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server#g'  
  32.  
  33.   $php_cf  
  34.  
  35.   sed -i '/expose_php/s/On/Off/' $php_cf  
  36.  
  37.   sed -i '/display_errors/s/On/Off/' $php_cf  
  38.  
  39.   -------------------cut end-------------------------------------------  

CentOS下的LAMP環(huán)境之A.M.P環(huán)境的介紹。

【編輯推薦】

  1. Ubuntu下LAMP的搭建
  2. Centos下搭建LAMP
  3. Linux下LAMP的安裝方法
責任編輯:zhaolei 來源: javaeye
相關(guān)推薦

2011-03-09 16:16:57

CentOSLAMP

2011-03-09 16:16:54

CentOSLAMP

2011-03-09 16:16:56

CentOSLAMP

2011-03-09 16:17:21

CentOSLAMP

2011-03-09 16:28:25

2011-09-09 17:23:53

CentOSLAMPmysql

2011-03-21 11:33:09

LAMPApache

2011-03-21 11:43:45

LAMPPHP

2011-03-14 10:30:15

Ubuntu10.04LAMP

2011-03-21 14:13:44

LAMPApacheSSL

2011-03-22 10:25:54

UbuntuLAMP

2011-03-09 13:02:31

LAMP環(huán)境搭建

2011-03-14 13:06:58

LAMP搭建

2011-03-21 16:49:53

2011-03-21 13:04:38

LAMPApache

2011-03-23 10:13:53

LAMP環(huán)境搭建

2011-03-10 14:40:48

LAMP搭建

2011-03-10 15:44:18

CentOSLAMP安裝

2011-03-10 15:44:18

CentOSLAMP安裝

2011-04-02 11:40:17

LAMP測試環(huán)境
點贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 欧美日韩国产精品激情在线播放 | 免费看一区二区三区 | 亚洲成人毛片 | 91在线视频在线观看 | 成人小视频在线观看 | 久久精品99久久 | 欧美色成人 | 亚洲欧美在线视频 | 狠狠色综合久久婷婷 | 日本视频免费观看 | 91不卡 | 久久久久国产一区二区三区 | 亚洲一区二区三区视频免费观看 | 精品一二三区 | 欧美日韩国产欧美 | 夜夜操天天艹 | 精品香蕉一区二区三区 | 欧美精品99 | 夜夜夜夜夜夜曰天天天 | 中文字幕在线三区 | 午夜av免费| 成人小视频在线观看 | 四虎在线观看 | 国产精品日韩在线观看一区二区 | 亚洲精品在线91 | 国产精品一区在线 | 欧美视频免费在线 | 欧美日韩成人在线 | 亚洲欧美在线一区 | 国产精品99久久久久久www | 国内精品99 | 亚洲免费一区二区 | 久久99精品久久久97夜夜嗨 | 欧美一级电影免费观看 | 午夜影院中文字幕 | 91精品国产91| 欧美4p| 国产精品久久久久久久7电影 | 国产精品亚洲视频 | 亚洲精品一区二区三区在线 | 日韩国产在线 |