rpm -qa httpd
apache 安装:
——————————————————————————————————————
yum install zlib zlib-devel
./configure \
–prefix=/application/apache2.2.27 \
–enable-deflate \ 压缩
–enable-expires \ 有效期
–enable-headers \
–enable-modules=most \
–enable-so \ 可扩展模块
–with-mpm=worker \ worker模式 多进程
–enable-rewrite
make && make install -j 4
error
checking for zlib location… not found
checking whether to enable mod_deflate… configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
zlib库没有安装 YUM zlib 库就可以了
yum install zlib zlib-devel -y
出故障先检查
1 防火墙。sellinux 有没有关闭
2 ps -ef |grep httpd 进程有没存在
3 netstat -lantup|grep :80 看端口
4 本地curl localhost 或
5 换客户端查
修改 httpd.con
66: User www
67: Group www
安装 CustomLog “|/usr/local/sbin/cronolog /root/acces_log_%Y-%m-%d.log” combined 在站点日志下添加下面一行 用cronolog轮循
CustomLog “|/usr/local/sbin/cronolog /root/acces_log_%Y-%m-%d.log” combined
useradd -s /sbin/nologin -M www
25 DirectoryIndex index.html
26
Options Indexes FollowSymLinks 目录浏览 不推广打开
CGI 模块可删除
extra/
httpd-vhosts.conf
httpd-mpm.conf
httpd-default.conf
useradd mysql -M -s /sbin/nologin
mysql 安装:
wget http://pan.baidu.com/s/1nvyK5x3
./configure \
–prefix=/application/mysql5.1.72 \
–with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
–localstatedir=/application/mysql5.1.72/data \
–enable-assembler \
–enable-thread-safe-client \
–with-mysqld-user=mysql \
–with-big-tables \
–without-debug \
–with-pthread \
–enable-assembler \
–with-extra-charsets=complex \
–with-readline \
–with-ssl \
–with-embedded-server \
–enable-local-infile \
–with-plugins=partition,innobase \
–with-mysqld-ldflags=-all-static \
–with-client-ldflags=-all-static
make && make install -j 2
ln -s /application/mysql-5.1.72 /application/mysql
添加开机启动
cp /root/mysql-5.1.72/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig –add /etc/init.d/mysqld
chkconfig mysqld on
/etc/init.d/mysqld start
初始化数据库
mkdir /application/mysql/data
/application/mysql/bin/mysql_install_db –basedir=/application/mysql –datadir=/application/mysql/data/ –user=mysql
ln -s /application/mysql/bin/mysql /bin/mysql
mysql
use mysql
update user set password=password(‘123’) where user=’root’;
plush privileges;
PHP安装:
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel -y
http://pan.baidu.com/s/1nvyK5x3
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure –prefix=/usr/local/libiconv
make
make install
cd ../
http://pan.baidu.com/s/1gfbWdSv
./configure \
–prefix=/application/php5.3.27 \
–with-apxs2=/application/apache/bin/apxs \
–with-mysql=/application/mysql \
–with-xmlrpc \
–with-openssl \
–with-zlib \
–with-freetype-dir \
–with-gd \
–with-jpeg-dir \
–with-png-dir \
–with-iconv=/usr/local/libiconv \
–enable-short-tags \
–enable-sockets \
–enable-zend-multibyte \
–enable-soap \
–enable-mbstring \
–enable-static \
–enable-gd-native-ttf \
–with-curl \
–with-xsl \
–enable-ftp \
–with-libxml-dir
make && make install
cp php.ini-production /application/php/lib/php.ini
httpd.conf 里的下添加
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
重启服务
测试lamp: