安装apache
[[email protected] ctyun]# tar zxf httpd-2.2.17.tar.gz
[[email protected] ctyun]# cd httpd-2.2.17
[[email protected] httpd-2.2.17]# ./configure --prefix=/application/apache2.2.17 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite
[[email protected] httpd-2.2.17]# make && make install
[[email protected] httpd-2.2.17]# ln -s /application/apache2.2.17/ /application/apache
[[email protected] httpd-2.2.17]# groupadd apache
[[email protected] httpd-2.2.17]# useradd -s /sbin/nologin -g apache -M apache
[[email protected] httpd-2.2.17]# cd /application/apache/conf/
[[email protected] conf]# cp httpd.conf httpd.conf.ori
[[email protected] conf]# cp extra/httpd-vhosts.conf extra/httpd-vhosts.conf.ori
[[email protected] conf]# vi httpd.conf
修改用户
User apache
Group apache
更改监听端口
#Listen 12.34.56.78:80
Listen 81
优化启动提示
#ServerName www.example.com:80
ServerName 127.0.0.1:80
开启扩展配置文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
给目录添加权限 #指定 网站根目录这是针对三个站点网站赋权限!这就不再需要修改站点目录,一次性 全做出来
<Directory /data/www>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
修改扩展配置文件
[[email protected] conf]# vi extra/httpd-vhosts.conf
NameVirtualHost *:81
<VirtualHost *:81>
ServerAdmin [email protected]
DocumentRoot "/data/www/www"
ServerName 123123123.com
ErrorLog "logs/www-error_log"
CustomLog "logs/www-access_log" common
</VirtualHost>
<VirtualHost *:81>
ServerAdmin [email protected]
DocumentRoot "/data/www/bbs"
ServerName 123123123.com
ErrorLog "logs/bbs-error_log"
CustomLog "logs/bbs-access_log" common
</VirtualHost>
[[email protected] conf]# mkdir /data/www/{www,bbs,blog} -p
[[email protected] conf]# echo "http://blog.etiantian.org" >/data/www/blog/index.html
[[email protected] conf]# echo "http://bbs.etiantian.org" >/data/www/bbs/index.html
检查语法
[[email protected] conf]# /application/apache/bin/apachectl -t
Syntax OK
启动apache
[[email protected] conf]# /application/apache/bin/apachectl start
查看端口
[[email protected] conf]# netstat -lntp |grep 81
tcp 0 0 :::81 :::* LISTEN 2733/httpd
安装mysql
[[email protected] bin]# groupadd mysql
[[email protected] bin]# useradd -g mysql mysql
[[email protected] ctyun]# tar zxf mysql-5.0.40.tar.gz
[[email protected] ctyun]# cd mysql-5.0.40
[[email protected] mysql-5.0.40]# ./configure --prefix=/application/mysql-5.0.40 --sysconfdir=/etc --localstatedir=/var/lib/mysql --with--charset=gbk --enable-thread-safe-client --with-extra-charsets="gbk gb2312 big5 utf8"
[[email protected] mysql-5.0.40]# make && make install
初始化
[[email protected] bin]# /application/mysql/bin/mysql_install_db
[[email protected] bin]# chmod 777 /var/lib/mysql
[[email protected] support-files]# cd /ctyun/mysql-5.0.40/support-files/
[[email protected] support-files]# cp mysql.server /etc/init.d/mysqld
[[email protected] support-files]# chmod +x /etc/init.d/mysqld
[[email protected] support-files]# /etc/init.d/mysqld start
Starting MySQL [ OK ]
[[email protected] support-files]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.40 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql> quit
Bye
安装PHP
报错
(一)configure: error: libpng.(a|so) not found.
[[email protected] php-5.2.17]# cp -frp /usr/lib64/libpng* /usr/lib/
(二)
[[email protected] php-5.2.17]# yum install libjpeg libpng -y
开始安装
[[email protected] ctyun]# tar zxf php-5.2.17.tar.gz
[[email protected] ctyun]# cd php-5.2.17
[[email protected] php-5.2.17]# ./configure --prefix=/application/php-5.2.17 --with-apxs2=/application/apache/bin/apxs --with-mysql=/application/mysql --with-xmlrpc --with-openssl --with-zlib --with-freetype-dir --with-gd --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 --with-iconv
[[email protected] php-5.2.17]# make && make install
[[email protected] php-5.2.17]# ln -s /application/php-5.2.17/ /application/php
[[email protected] php-5.2.17]# /bin/cp php.ini-recommended /application/php/lib/php.ini
mysql> create database username;
mysql> grant all privileges on *.* to [email protected] identified by ‘password‘;