如何進行直播搭建?
一、搭建前期準備
(1)生成軟體包資訊緩存
yum makecache
(2)安裝更新
yum update -y
(3)安裝必要軟體
yum install -y zip unzip wget curl git vim zsh nano screen
(4)安裝oh my zsh(有助于補全和選擇目錄)
sh -c "$(wget
https://raw.githubusercontent. com/robbyrusse11/ oh-my-zsh/master/too1s/install.sh -0
二、搭建LNMP環境
wget
http://mirrors.L inuxeye。com/oneinstack -full. tar. gz
tar xzvf oneinstack-ful1.tar. gz
cd oneinstack
./insta11.sh
樁:請勿sh install. sh或者bash install. sh這樣執行
三、redis配置
配置redis密碼
執行指令修改/usr/local/redis/etc/redis.conf檔案,(也可以手動修改redis.conf檔案)
echo requlrepass redis的密碼>> /usr/local/redis/etc/redis.conf
重新開機redis
四、建立資料庫
使用oneinstack- -鍵搭建 中的phpMyAdmin插件
Vim /etc/my. cnf
在my.cnf裡面設定
添加語句
sql_ mode='STRICT TRANS. TABLES,NO ZERO IN DATE,NO ZERO DATE, ERROR FOR_ DIVISION BY. _ZERO,NO AUTO CREA
TE_ USER,NO ENGINE SUBSTITUTION'
四、直播搭建與建立資料庫
使用oneinstack-鍵搭建中的phpMyAdmin插件
vim /etc/my.cnf
sql_ mode='STRICT TRANS TABLES,NO ZERO IN DATE,NO ZERO_ DATE, ERROR FOR_ DIVISION_ BY_ ZERO,NO_ AUTO CREA
TE_ USER,NO ENGINE_ SUBSTITUTION
五、 搭建直播程式
1.将代碼包裡面的web檔案夾中的東西拷貝到網站根目錄。
舉例說明:
假設您的站點為: www.abc.com
mv /root/web/* /data/wwwroot/www. abe , com/
//改變讀寫權限
chmod -R 777 /data/wwroot/www. abc . com/
2.還需修改幾個檔案:
<1> (web) /api/Config/app.php
*七牛相關配置
'Qiniu' => array(
//統一-的key
'accessKey'一‘七牛accessKey',
'secretKey' => '七牛secretKey',
//自定義配置的空間),
。本地上傳
*/
'UCloud' => array(
'db_ appapi' => array( //伺服器标
'host' => ' 資料庫位址’,//資料庫域名
'name' => ' 資料庫名",//資料庫名字
'user' 的> .資料庫使用者名’,//資料庫使用者
'password' => '資料庫密碼’, /資料庫密
'port' => ' 資料庫端口号",//資料庫端口
'charset' =》' 資料庫編碼",//資料庫字
,
),
<3> web/data/conf/db.php
return array(
'DB_ TYPE' => 'mysql' ,
'DB_ HOST' =》' 資料庫位址",
'DB_ NAME' =》‘資料庫名稱"
'DB_ USER' => '資料庫賬戶”,
'DB_ PIWD° => °資料庫密碼'
'DB_ PORT' =》' 資料庫端口",
'DB_ PREFIX'->‘cmf_',
);
<4> web/alipay_ app/notify _url.php
$link = mysq1_ _connect(" 資料庫位址" ,“資料庫使用者",”資料庫密碼");
if($link){<6>web/wxshare/Application/Common/Conf/config.php
: /數規庫配置/
'DB_ TYPE' > 'mysqll', //資料庫類型
'DB HOST' => °資料庫位址", //伺服器位址
'DB _NAME' =》'資料庫名’,//資料庫名
'DB_ _USER'》。資料庫使用者", //使用者名
'DB_ PWD'●" 資料庫密碼',//密碼
'DB_ PORT' => '資料庫端口’,//端口
'DB_ PREFIX' =》'cmf_ ”, //資料庫表前概
六、 服務重新開機
注釋掉
/usr/local/ php/etc/php. d/02-opcache.in1
這個PHP緩存,開發測試階段需要關閉否則會影響問題的修改和測試偏差。
清理掉web緩存
web/data/runtime/目錄下的檔案清空
service mysq1d restart
service php-fpm restart
systemctl restart redis-server
systemct1 restart nginx
做完這些,直播搭建就完成了