天天看點

全新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架構搭建備忘