您的位置:首页 > 博客中心 > 数据库 >

apache+mysql5.0

时间:2022-03-13 22:56

安装apache
[root@centos64x64 ctyun]# tar zxf httpd-2.2.17.tar.gz
[root@centos64x64 ctyun]# cd httpd-2.2.17
[root@centos64x64 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
[root@centos64x64 httpd-2.2.17]# make && make install
[root@centos64x64 httpd-2.2.17]# ln -s /application/apache2.2.17/ /application/apache
[root@centos64x64 httpd-2.2.17]#  groupadd apache
[root@centos64x64 httpd-2.2.17]#  useradd -s /sbin/nologin -g apache -M apache
[root@centos64x64 httpd-2.2.17]# cd /application/apache/conf/
[root@centos64x64 conf]# cp httpd.conf httpd.conf.ori
[root@centos64x64 conf]# cp extra/httpd-vhosts.conf extra/httpd-vhosts.conf.ori
[root@centos64x64 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>

修改扩展配置文件

[root@centos64x64 conf]#  vi extra/httpd-vhosts.conf
NameVirtualHost *:81

<VirtualHost *:81>
    ServerAdmin 123123@qq.com
    DocumentRoot "/data/www/www"
    ServerName  123123123.com
    ErrorLog "logs/www-error_log"
    CustomLog "logs/www-access_log" common
</VirtualHost>

<VirtualHost *:81>
    ServerAdmin 123123@qq.com
    DocumentRoot "/data/www/bbs"
    ServerName  123123123.com
    ErrorLog "logs/bbs-error_log"
    CustomLog "logs/bbs-access_log" common
</VirtualHost>

[root@centos64x64 conf]# mkdir /data/www/{www,bbs,blog} -p
[root@centos64x64 conf]# echo "http://blog.etiantian.org" >/data/www/blog/index.html
[root@centos64x64 conf]# echo "http://bbs.etiantian.org" >/data/www/bbs/index.html
检查语法
[root@centos64x64 conf]# /application/apache/bin/apachectl -t
Syntax OK
启动apache
[root@centos64x64 conf]# /application/apache/bin/apachectl start
查看端口
[root@centos64x64 conf]# netstat -lntp |grep 81
tcp        0      0 :::81                       :::*                        LISTEN      2733/httpd  


安装mysql
[root@centos64x64 bin]# groupadd mysql
[root@centos64x64 bin]# useradd -g mysql mysql
[root@centos64x64 ctyun]# tar zxf mysql-5.0.40.tar.gz
[root@centos64x64 ctyun]# cd mysql-5.0.40
[root@centos64x64 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"
[root@centos64x64 mysql-5.0.40]# make && make install
初始化

[root@centos64x64 bin]# /application/mysql/bin/mysql_install_db
[root@centos64x64 bin]# chmod 777 /var/lib/mysql
[root@centos64x64 support-files]# cd /ctyun/mysql-5.0.40/support-files/
[root@centos64x64 support-files]#  cp mysql.server /etc/init.d/mysqld
[root@centos64x64 support-files]# chmod +x /etc/init.d/mysqld
[root@centos64x64 support-files]# /etc/init.d/mysqld start
Starting MySQL                                             [  OK  ]

[root@centos64x64 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.

[root@centos64x64 php-5.2.17]# cp -frp /usr/lib64/libpng* /usr/lib/

(二)

[root@centos64x64 php-5.2.17]# yum install libjpeg libpng -y

开始安装
[root@centos64x64 ctyun]# tar zxf php-5.2.17.tar.gz
[root@centos64x64 ctyun]# cd php-5.2.17
[root@centos64x64 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

[root@centos64x64 php-5.2.17]# make && make install
[root@centos64x64 php-5.2.17]# ln -s /application/php-5.2.17/ /application/php
[root@centos64x64 php-5.2.17]# /bin/cp php.ini-recommended /application/php/lib/php.ini



mysql> create database username;
mysql> grant all privileges on *.* to adfreelanc_6@localhost identified by ‘password‘;

热门排行

今日推荐

热门手游