天天看点

全新64位CentOS6.X上LAMP架构搭建备忘

========================================================================================

ps: 生产环境必须都安装ga版本……很多配置还很不成熟……还需要不断完善和改进……

==========================================================================================

====================================================================================

------------------------------------------------------------------------------------------------------

conf/httpd.conf

==================================================================================

---------------------------------------------------

-----------------------------------------------

==================一些与加密相关的软件包

-------------------------------------------------------------------------------

在编译php5.2以上版本,经常会看到如下错误,常常以为是php的./configure后边什么参数没有写对,很让人费解

checking for mysql support... yes

checking for specified location of the mysql unix socket... no

checking for mysql unix socket location... no

configure: error: cannot find libmysqlclient_r under /usr/local/mysql. note that the mysql client library is not bundled anymore!其实这跟php没有关系

那是因为我在编译apache的时候,使用--with-mpm模块,所以就必须在编译mysql的时候加上 --enable-thread-safe-client.

这是php5.2的一个改进,在php5.2.0之前的版本都不需要mysql启用安全线程。关于--enable-thread-safe-client项的官方介绍如下:如何生成线程式客户端客户端库总是线程安全的。最大的问题在于从套接字读取的net.c中的子程序并不是中断安全的。或许你可能希望用自己的告警中断对服务器的长时间读取,以此来解决问题。如果为sigpipe中断安装了中断处理程序,套接字处理功能应是线程安全的。为了避免连接中断时放弃程序,mysql将在首次调用mysql_server_init()、mysql_init()或mysql_connect()时屏蔽sigpipe。如果你打算使用自己的sigpipe处理程序,首先应调用mysql_server_init(),然后安装你的处理程序.

////  ---------> 这可如何是好呀!

yum install php-mysql.x86_64 mysql-devel.x86_64           //ok个屁!

-------------------------------------------------------------------------------------

===================================================================================================

===========  --with-mysql  --with-libdir=/lib64           ///for 64bit

-----------------------------------------------------------------------

转载部分

-----------------------------------------------------------------------------

+--------------------------------------------------------------------------------------------------------+

|                        *** warning ***                                                                                     |

|                                                                                                                                            |

| you have built php for apache's current non-threaded mpm.                                |

| if you change apache to use a threaded mpm you must reconfigure                   |

| php with --enable-maintainer-zts                                                                               |

| license:                                                                                                                            |

| this software is subject to the php license, available in this                              |

| distribution in the file license.  by continuing this installation                            |

| process, you are bound by the terms of this license agreement.                         |

| if you do not agree with the terms of this license, you must abort                        |

| the installation process at this point.                                                                          |

//make clean  之后,添加了 --enable-maintainer-zts 还是报这样的警告,重新来一次还是一样的!先忽略了!

make 照样报错!

php5.4.11 安装出现 error: ‘struct gdioctx’ has no member named ‘data’

ext/gd/gd_ctx.c:67:8: error: ‘struct gdioctx’ has no member named ‘data’

解决方法:这个错误算是php5.4的bug?下面对应的两篇文章有对应的说明:

<a target="_blank" href="https://bugs.php.net/bug.php?id=55224">https://bugs.php.net/bug.php?id=55224</a>

<a target="_blank" href="https://bugs.php.net/bug.php?id=60108">https://bugs.php.net/bug.php?id=60108</a>

个人采用的方法:

vi &lt;gd_dir&gt;/include/gd_io.h                 ///        /usr/local/include/gd_io.h

gdioctx结构中增加void *data;

make clean后重新./configure

====================================================================经过上面的倒腾,game over!!!

===============后来在32位机器上又编译一次. --with-mysql=/usr/loca/mysql 这个!我记着了!

===============再一次编译, 我甚至放弃了 openssl装了又卸, 卸了又装---

===============lamp的高效配置很重要, 对我来说还是效率太低了! coding!

vim /www/index.php

&lt;?php

phpinfo();

?&gt;

service apache2 restart

===============================================================================

=============================================先简单测试phpwind论坛和wordpress博客!

分别解压到 /www

chown daemon:daemon /www  -r

然后建库,授权!

mysql&gt;create database bbs;

mysql&gt;grant all on bbs.* to 'tao'@'10.10.24.%' identified by '123';     ///wrong

[mysql&gt;revoke all on bbs.* from 'tao'@'10.10.24.%';]

mysql&gt;grant all on bbs.* to 'tao'@'192.168.10.%' identified by '123';   

//因为浏览器虽然在10.10.24.79这儿,但是它连接数据库还是在 192.168.10.112

mysql&gt;show grants for 'tao'@'192.168.10.%';

//可以这样查看赋的权!

vim /www/wordpress/wp-config.php

修改好对应的数据库名以及用户和密码之类的信息!【god, 原来我的密码写错了 wordpress--&gt;wordress】

-------------------&gt;各种报错,说连不上数据库!然后在 wp-config.php 中添加如下两行,之后看日志处理!

define('wp_allow_repair', true);

define('wp_debug', 'true');

-----------------------------------

-------------------------------------------------

然后修改apache配置文件,添加两台虚拟主机!

还是先基于端口做虚拟主机吧,不基于ip和域名,想到基于域名符合生产环境的要求,

就搭台简单的dns服务器,也不做智能的分离解析,主从和反向也先不做了,貌似反向解析应该做,

到时候还需要完成windows上邮件系统的搭建,反向解析有必要搭建好!

然后完成基于域名的虚拟主机!

!=====================================dns===================================

yum install -y bind* caching-nameserver*    ///貌似caching-nameserver这个包集成到了bind...包中!

yum install -y ntpdate*            //我看时间不对,查看到这儿没有ntp服务器,就用一下微软的呗

ntpdate time.windows.com   //简单的时间同步,保证实验的顺利进行!

cp /usr/share/doc/bind-9.8.2/sample/etc/named.conf /var/named/chroot/etc/

cp /usr/share/doc/bind-9.8.2/sample/var/named/named.ca /var/named/chroot/var/named/

cp /usr/share/doc/bind-9.8.2/sample/var/named/named.localhost /var/named/chroot/var/named/

---------&gt;named.conf

-----------------------

chown named:named named.conf

mv named.localhost ln_credbile.cn.zone

-----------------&gt;ln_credbile.cn.zone

---------------------------------------

chown named:named named.ca ln_credbile.cn.zone

------------------------先小修改一下主机名

vim /etc/hosts

192.168.10.112  taolr.ln_credbile.cn

vim /etc/sysconfig/network

hostname=taolr.ln_credbile.cn

hostname 192.168.10.112              //没法重启系统,就先临时生效呗

----------------------------------

named-checkconf named.conf

named-checkzone ln_credbile.cn ln_credbile.cn.zone 

……

rndc: neither /etc/rndc.conf nor /etc/rndc.key was found

注意的一个点,centos下的dns和红帽下有一点不同!

centos 6.3下dns服务器配置问题

service named start

generating /etc/rndc.key:

运行下面的命令导入key

rndc-confgen -r /dev/urandom -a

service named start                     ///did it!

=============================================================================

vitualhost配置

/usr/local/apache2/bin/htpasswd -c /usr/local/apache2/conf/.htpasswd user1

/usr/local/apache2/bin/htpasswd /usr/local/apache2/conf/.htpasswd user2

/usr/local/apache2/bin/htpasswd /usr/local/apache2/conf/.htpasswd user3

-------&gt;passwd:taolinran

-----------------&gt;httpd-vhosts.conf

//namevirtualhost 192.168.100.30

//启动基于域名的虚拟web服务器!后面没有 “:80”,端口,后面的就都不要加了!

//如果加了,后面的就都要加上!

&lt;virtualhost&gt;

&lt;/virtualhost&gt;

全新64位CentOS6.X上LAMP架构搭建备忘