yum install -y httpd mysql-server php php-devel php-mysql(安装lamp环境)
yum -y install httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
zend安装
wget downloads.zend/optimizer/3.2.2/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# tar xzvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# ./ZendOptimizer-3.2.2-
linux-glibc21-i386/install.sh
mysql_install_db数据库初始化
mysqladmin -u root password 'newpass'(修改root密码)(在shell模式下)
mysql -u root -p (以root权限进入Mysql控制台)
create database discuz;(建立discuz数据库)
show databases;(显示所有数据库)
grant all privileges on financial.* to financialuser@localhost identified by 'ivedu123321??';(添加用户discuz 密码为discuz123并授权discuz数据库)
mysqldump -u username -p dbname >aaa.sql;
mysql -u username -p dbname
一、虚拟主机
vhost.conf内容
Options FollowSymLinks
AllowOverride None
Order deny,allow
Options FollowSymLinks
AllowOverride None
Order deny,allow
NameVirtualHost 192.168.128.131:80
ServerName 192.168.128.131
DocumentRoot /dev/null
ServerName dz.b
DocumentRoot /home/discuz/web
#CustomLog /var/log/httpd/dz.access_log (如果出错添加common)
ServerName pw.b
DocumentRoot /home/phpwind/web
#CustomLog /var/log/httpd/pw_access_log
网站显示乱码:在httpd.conf 修改:
AddDefaultCharset off
AddDefaultCharset gb2312
修改PHP.ini
default_charset = “UTF-8″
二、https建立
yum install -y mod_ssl
mkdir /etc/httpd/conf/ssl.key(Public Key目录)
cd /etc/httpd/conf/ssl.key
openssl genrsa -out Server.key 1024
建立凭证
cd /etc/conf
mkdir ssl.crt
openssl req -new -x509 -key ../ssl.key/Server.key -out Server.crt
vi /etc/httpd/conf.d/ssl.conf
三、编译部分
libxml库
./configure --prefix=/usr/local/libxml2
make
make install
编译Mysql
./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-Community --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=latin1 --with-collation=latin1_swedish_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug
make
make install
# useradd mysql //添加 mysql 用户
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root:mysql . //设置权限,注意后面有一个 "."
# chown
-R mysql /var/lib/mysql //设置 mysql 目录权限
# chgrp -R mysql . //注意后面有一个 "."
# cp share/mysql/my-hugef /etc/myf
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //开机自动启动 mysql。
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# /etc/rc.d/init.d/mysqld start //启动 MySQL
# bin/mysqladmin -u root password "password_for_root"
# service mysqld stop //关闭 MySQL
编译安装 Apache
./configure --prefix=/usr/local/apache2 --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-cgid --disable-cgi --disable-userdir --with-mpm=worker --enable-authn-dbm=shared --enable-authn-anon=shared --enable-authn-dbd=shared --enable-auth-basic=shared
make
make install
echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local //将 apachectl 的调用加入到你的系统启动文件中。
注解:
./configure //配置源代码树
--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。
--enable-module=so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块
--enable-deflate=shared //支持网页压缩
--enable-expires=shared //支持 HTTP 控制
--enable-rewrite=shared //支持 URL 重写
--enable-cache //支持缓存
--enable-file-cache //支持文件缓存
--enable-mem-cache //支持记忆缓存
--enable-disk-cache //支持磁盘缓存
--enable-static-support //支持静态连接(默认为动态连接)
--enable-static-htpasswd //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件
--enable-static-htdigest //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件
--enable-static-rotatelogs //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序
--enable-static-logresolve //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名
--enable-static-htdbm //使用静态连接编译 htdbm - 操作 DBM 密码数据库
--enable-static-ab //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具
--enable-static-checkgid //使用静态连接编译 checkgid
--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本
--disable-cgi //禁止编译 CGI 版本的 PHP
--disable-userdir //禁止用户从自己的主目录中提供页面
--with-mpm=worker // 让apache以worker方式运行
--enable-authn-dbm=shared // 对动态数据库进行操作。Rewrite时需要。
编译php 5.2.0
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local
/gd2 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static
make
make install
整合apache与php
vi /usr/local/apache2/conf/httpd.conf
在最后一行加上:
AddType application/x-httpd-php .php
AllowOverride all允许rewrite和.htaccess
安装 Zend
./ZendOptimizer-3.2.0-linux-glibc21-i386/install.sh
安装eaccelerator(加速 zend一般是加密)
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize //指定一下php的目录
# ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config // 设置
# make &; make install
编译安装后我们会看到屏幕提示的eaccelerator.so所在的目录,比如我得到的是/usr/local/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so,记住这个路径,待会要用到。
修改php.ini(安装完zend之后,php.ini存放于/usr/local/Zend/etc)
在文件最后,zend之前,注意,这部分内容务必放在zend之前,不然可能会出现不可预期的服务器问题。添加下列信息:
extension="/usr/local/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="