LAMP+redis搭建discuz論壇

來源:互聯網
上載者:User

標籤:lamp、redis

此實驗需要三台伺服器:

三台伺服器如下:

192.168.1.155  安裝LAP環境

192.168.1.156 安裝MySQL資料庫

192.168.1.135 安裝redis快取服務器

1.yum 安裝AP環境:

yum install httpd httpd-devel php php-devel php-mysql -y

2.安裝資料庫  詳見以下連結:

http://jiaxinwang.blog.51cto.com/12273793/1935065

3.啟動httpd服務

systemctl start httpd

4. 關閉防火牆和selinux服務或者加上相應的連接埠

systemctl stop firewalld

setenforce 0

5.下載discuz網站模板(下載在/var/www/html目錄下)

wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

6.解壓

unzip Discuz_X3.2_SC_UTF8.zip

由於網站代碼在upload 所以把upload檔案夾的檔案移動到發布目錄下

7.發現目錄不存在和不可寫;給許可權

chmod -R 757 data/ config/ uc_client/ uc_server/

8.在發布目錄下找到config_global.php檔案修改檔案

目錄:/var/www/html/config

修改為:$_config[‘db‘][‘1‘][‘dbhost‘] = ‘192.168.1.156‘;

9.建立資料庫

資料庫名:伺服器的IP或者網域名稱 192.168.1.156

資料庫名:在資料庫中建立個資料庫

資料庫使用者名稱:root

資料庫密碼:123456

再加個密碼,其他預設

建立資料庫的命令:create database discuz;

10.當下一步時出現Host ‘192.168.1.156‘ is not allowed to connect to this MySQL server這個錯誤時;

解決:給資料庫root一個可以遠端存取的許可權

grant all on *.* to [email protected]‘%‘ identified by ‘123456‘;

然後問題解決,下一步,等待安裝完成!

11.下載redis 本實驗使用的是redis-2.8.18

解壓:tar zvxf redis-2.8.18.tar.gz

進入解壓目錄:cd redis-2.8.18/

先行編譯: make PREFIX=/usr/local/redis install

安裝:make && make install

12.將安裝目錄的bin檔案的檔案做個軟串連到/usr/bin/下

ln -s /usr/local/redis/bin/* /usr/bin/

13.在解壓目錄下有redis.conf設定檔 拷貝到安裝目錄下

cp /root/redis-2.8.18/redis.conf /etc/redis/

14.啟動redis

進入設定檔

vim /etc/redis/redis.conf

將daemonize no 改為daemonize yes

儲存、退出

啟動接設定檔  redis-server /etc/redis/redis.conf

ps -ef | grep redis

root     53762     1  0 17:53 ?        00:00:06 redis-server *:6379

root     54130  1700  0 18:24 pts/0    00:00:00 grep --color=auto redis

15.到發布目錄下修改config_global.php檔案

/var/www/html/config

$_config[‘memory‘][‘redis‘][‘server‘] = ‘192.168.1.135‘;####改為redis伺服器IP地址

16.在redis伺服器輸入 redis-cli進入redis

在論壇上隨便點擊(產生keys值)然後在redis伺服器輸入keys *查看keys值

發現沒有 因為php沒有redis模組,要添加phpredis模組

(做個php測試頁面,如果找不到redis說明沒有redis模組)

17.下載安裝phpredis

wget https://github.com/phpredis/phpredis/archive/3.1.2.tar.gz

tar zvxf 3.1.2.tar.gz

cd phpredis-3.1.2/

phpize(php初始化)

./configure --with-php-config=/usr/bin/php-config --enable-redis(先行編譯)

make && make install(安裝)

18.在php設定檔中添加redis模組

vim /etc/php.ini

extension_dir = "/usr/lib64/php/modules/"

extension=redis.so

18.重啟httpd服務

systemctl restart httpd

19.再去論壇點幾下,產生keys值,然後去redis看下有沒有keys值產生

KEYS *

1) "69ZeIg_cronpublish"

2) "69ZeIg_globalstick"

3) "69ZeIg_usergroup_19"

4) "69ZeIg_usergroup_18"

5) "69ZeIg_threadtable_info"

6) "69ZeIg_smilies"

7) "69ZeIg_usergroup_16"

8) "69ZeIg_userstats"

9) "69ZeIg_pluginlanguage_system"

10) "69ZeIg_usergroup_5"

................................

127.0.0.1:6379>

註:防火牆和setenforce


本文出自 “帥小欣” 部落格,謝絕轉載!

LAMP+redis搭建discuz論壇

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.