mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
自动复制证书至可执行目录
This commit is contained in:
parent
9247cb9571
commit
d1f722939d
@ -1 +1 @@
|
|||||||
Subproject commit 086b14bdc9924f7f86f53d0fa542b8568bff5bc8
|
Subproject commit e79d24b51051ed9b3bd9c66b9d8ace3c76a0411a
|
@ -1,4 +1,6 @@
|
|||||||
#查找SDL2是否安装
|
execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ssl.pem ${EXECUTABLE_OUTPUT_PATH}/)
|
||||||
|
|
||||||
|
#查找SDL2是否安装
|
||||||
find_package(SDL2 QUIET)
|
find_package(SDL2 QUIET)
|
||||||
if (SDL2_FOUND)
|
if (SDL2_FOUND)
|
||||||
include_directories(${SDL2_INCLUDE_DIR})
|
include_directories(${SDL2_INCLUDE_DIR})
|
||||||
|
@ -112,26 +112,16 @@ int main(int argc,char *argv[]){
|
|||||||
//加载配置文件,如果配置文件不存在就创建一个
|
//加载配置文件,如果配置文件不存在就创建一个
|
||||||
loadIniConfig();
|
loadIniConfig();
|
||||||
|
|
||||||
#ifdef ENABLE_OPENSSL
|
|
||||||
//请把证书"test_httpApi.pem"放置在本程序可执行程序同目录下
|
|
||||||
try{
|
|
||||||
//加载证书,证书包含公钥和私钥
|
//加载证书,证书包含公钥和私钥
|
||||||
SSL_Initor::Instance().loadServerPem((exePath() + ".pem").data());
|
SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data());
|
||||||
}catch(...){
|
|
||||||
ErrorL << "请把证书:" << (exeName() + ".pem") << "放置在本程序可执行程序同目录下:" << exeDir() << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif //ENABLE_OPENSSL
|
|
||||||
|
|
||||||
//开启http服务器
|
//开启http服务器
|
||||||
TcpServer::Ptr httpSrv(new TcpServer());
|
TcpServer::Ptr httpSrv(new TcpServer());
|
||||||
httpSrv->start<EchoWebSocketSession>(mINI::Instance()[Http::kPort]);//默认80
|
httpSrv->start<EchoWebSocketSession>(mINI::Instance()[Http::kPort]);//默认80
|
||||||
|
|
||||||
#ifdef ENABLE_OPENSSL
|
|
||||||
//如果支持ssl,还可以开启https服务器
|
//如果支持ssl,还可以开启https服务器
|
||||||
TcpServer::Ptr httpsSrv(new TcpServer());
|
TcpServer::Ptr httpsSrv(new TcpServer());
|
||||||
httpsSrv->start<SSLEchoWebSocketSession>(mINI::Instance()[Http::kSSLPort]);//默认443
|
httpsSrv->start<SSLEchoWebSocketSession>(mINI::Instance()[Http::kSSLPort]);//默认443
|
||||||
#endif //ENABLE_OPENSSL
|
|
||||||
|
|
||||||
InfoL << "你可以在浏览器输入:http://127.0.0.1/api/my_api?key0=val0&key1=参数1" << endl;
|
InfoL << "你可以在浏览器输入:http://127.0.0.1/api/my_api?key0=val0&key1=参数1" << endl;
|
||||||
|
|
||||||
|
@ -274,15 +274,8 @@ int main(int argc,char *argv[]) {
|
|||||||
" rtsp地址 : rtsp://127.0.0.1/live/0\n"
|
" rtsp地址 : rtsp://127.0.0.1/live/0\n"
|
||||||
" rtmp地址 : rtmp://127.0.0.1/live/0";
|
" rtmp地址 : rtmp://127.0.0.1/live/0";
|
||||||
|
|
||||||
//请把证书"test_server.pem"放置在本程序可执行程序同目录下
|
|
||||||
try {
|
|
||||||
//加载证书,证书包含公钥和私钥
|
//加载证书,证书包含公钥和私钥
|
||||||
SSL_Initor::Instance().loadServerPem((exePath() + ".pem").data());
|
SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data());
|
||||||
} catch (...) {
|
|
||||||
ErrorL << "请把证书:" << (exeName() + ".pem") << "放置在本程序可执行程序同目录下:" << exeDir() << endl;
|
|
||||||
proxyMap.clear();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t shellPort = mINI::Instance()[Shell::kPort];
|
uint16_t shellPort = mINI::Instance()[Shell::kPort];
|
||||||
uint16_t rtspPort = mINI::Instance()[Rtsp::kPort];
|
uint16_t rtspPort = mINI::Instance()[Rtsp::kPort];
|
||||||
|
Loading…
Reference in New Issue
Block a user