LNMP环境部署_inmap nginx部署-程序员宅基地

技术标签: 运维管理  nginx  linux  mysql  

LNMP环境部署

1. LNMP部署规划

  1. 软件规划
版本
Nginx Nginx 1.16.1
MySQL MySQL 5.7.28
PHP PHP 7.0.33
  1. 系统规划

操作系统:CentOS Linux release 7.3.1611

主机 IP地址
node07.host.com 172.24.248.19
node08.host.com 172.24.248.20
node09.host.com 172.24.248.21

2. Nginx部署

2.1 Nginx介绍

nginx官网

WEB服务器也称为WWW(WORLD WIDE WEB)服务器,主要功能是提供网上信息浏览服务。 WWW 是 Internet的多媒体信息查询工具,是 Internet 上近年才发展起来的服务,也是发展最快和目前用的最广泛的服务。正是因为有了WWW工具,才使得近年来 Internet 迅速发展,且用户数量飞速增长。

Nginx (“engine x”) 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。

它已经在众多流量很大的俄罗斯网站上使用了很长时间,这些网站包括YandexMail.RuVKontakte,以及Rambler。据Netcraft统计,在2012年8月份,世界上最繁忙的网站中有11.48%使用Nginx作为其服务器或者代理服务器。目前互联网主流公司360、百度、新浪、腾讯、阿里等,目前中国互联网企业70%以上公司都在使用nginx作为自己的web服务器。

Nginx特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好。

Nginx由内核和模块组成,其中,内核的设计非常微小和简洁,完成的工作也非常简单,仅仅通过查找配置文件将客户端请求映射到一个location block(location是Nginx配置中的一个指令,用于URL匹配),而在这个location中所配置的每个指令将会启动不同的模块去完成相应的工作。

Nginx相对于Apache优点

1)   高并发响应性能非常好,官方Nginx处理静态文件并发5w/s

2)   反向代理性能非常强。(可用于负载均衡)

3)   内存和cpu占用率低。(为Apache的1/5-1/10)

4)   对后端服务有健康检查功能。

5)   支持PHP cgi方式和fastcgi方式。

6)   配置代码简洁且容易上手。

2.2 Nginx 工作原理

Nginx由内核和模块组成,其中,内核的设计非常微小和简洁,完成的工作也非常简单,仅仅通过查找配置文件将客户端请求映射到一个location block(location是Nginx配置中的一个指令,用于URL匹配),而在这个location中所配置的每个指令将会启动不同的模块去完成相应的工作.

Nginx的模块从结构上分为核心模块、基础模块和第三方模块

核心模块:HTTP模块、EVENT模块和MAIL模块

基础模块:HTTP Access模块、HTTP FastCGI模块、HTTP Proxy模块和HTTP Rewrite模块,

第三方模块:HTTP Upstream Request Hash模块、Notice模块和HTTP Access Key模块。

Nginx的高并发得益于其采用了epoll模型,与传统的服务器程序架构不同,epoll是linux内核2.6以后才出现的。Nginx采用epoll模型,异步非阻塞,而Apache采用的是select模型:

Select特点:select 选择句柄的时候,是遍历所有句柄,也就是说句柄有事件响应时,select需要遍历所有句柄才能获取到哪些句柄有事件通知,因此效率是非常低。

epoll的特点:epoll对于句柄事件的选择不是遍历的,是事件响应的,就是句柄上事件来就马上选择出来,不需要遍历整个句柄链表,因此效率非常高

2.3 Nginx安装

  1. 环境依赖
[[email protected] ~]#  yum -y install vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-comletion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed gd-devel GeoIP GeoIP-devel GeoIP-data 

  1. 编译安装nginx
[[email protected] /usr/local/src]# tar xf nginx-1.16.1.tar.gz
[[email protected] /usr/local/src]# useradd nginx -s  /sbin/nologin -u 2000 
[[email protected] /usr/local/src]# cd nginx-1.16.1
[[email protected] /usr/local/src/nginx-1.16.1]# cat src/core/nginx.h |grep NGINX_VER
#define NGINX_VERSION      "1.16.1"   
define NGINX_VER          "nginx/" NGINX_VERSION   #开启server_tokens显示此信息
[[email protected] /usr/local/src/nginx-1.16.1]# cat src/http/ngx_http_header_filter_module.c |grep "NGINX_VER_BUILD"
static u_char ngx_http_server_build_string[] = "Server: " NGINX_VER_BUILD CRLF; #关闭server_tokens显示此信息
[[email protected] /usr/local/src/nginx-1.16.1]#  

[[email protected] /usr/local/src/nginx-1.16.1]# ./configure --prefix=/apps/nginx  --with-http_ssl_module --with-http_v2_module  --with-http_realip_module --with-http_addition_module  --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
[[email protected] /usr/local/src/nginx-1.16.1]# make && make install

  1. 配置nginx,自定义json日志,error页面,并启动nginx
[[email protected] /apps/nginx/conf]# egrep -v "#|^$" nginx.conf
user  nginx;
worker_processes  2;
worker_cpu_affinity 01 10;
error_log  /apps/nginx/logs/error.log  error;
pid        /apps/nginx/logs/nginx.pid;
worker_priority 0;
worker_rlimit_nofile 65536;
events {
     
  worker_connections  65536;
  use epoll;
  accept_mutex on;
  multi_accept on;
}
http {
     
  include       mime.types;
  default_type  application/octet-stream;

  log_format access_json '{"@timestamp":"$time_iso8601",'
     '"host":"$server_addr",'
     '"clientip":"$remote_addr",'
     '"size":$body_bytes_sent,'
     '"responsetime":$request_time,'
     '"upstreamtime":"$upstream_response_time",'
     '"upstreamhost":"$upstream_addr",'
     '"http_host":"$host",'
     '"uri":"$uri",'
     '"domain":"$host",'
     '"xff":"$http_x_forwarded_for",'
     '"referer":"$http_referer",'
     '"tcp_xff":"$proxy_protocol_addr",'
     '"http_user_agent":"$http_user_agent",'
     '"status":"$status"}';
   access_log /apps/nginx/logs/access_json.log access_json;
  sendfile        on;
  keepalive_timeout  65 65;
  server_tokens off;
  server {
     
      listen       80;
      server_name  localhost;
      charset utf-8;
      location / {
     
          root   html;
          index  index.html index.htm;
      }
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
     
          root   html;
      }
  }
include /apps/nginx/conf/conf.d/*.conf;
}
[[email protected] /apps/nginx/conf]#
[[email protected] /apps/nginx]# cd html/
[[email protected] /apps/nginx/html]# echo "access page error" > error.html
[[email protected] /apps/nginx/html]# chown nginx.nginx -R /apps/nginx/
# 查看版本以及编译参数
[[email protected] ~]# /apps/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/apps/nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_gunzip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
# 检查nginx配置语法是否正确
[[email protected] ~]# /apps/nginx/sbin/nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[[email protected] ~]# 
# 启动nginx
[[email protected] ~]# /apps/nginx/sbin/nginx
  1. 页面验证nginx

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-gk6DeCFP-1612149734988)(C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20210126173130434.png)]

3. MySQL部署

官网地址

  1. 二进制安装mysql
[[email protected] ~]# tar xf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz 
[[email protected] ~]# ln -sv /usr/local/mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql-5.6.36
"/usr/local/mysql-5.6.36" -> "/usr/local/mysql-5.6.36-linux-glibc2.5-x86_64"
[[email protected] ~]# useradd mysql -s /sbin/nologin
[[email protected] ~]# mkdir -pv /opt/mysql /var/lib/mysql
mkdir: 已创建目录 "/opt/mysql"
[[email protected] ~]# chown -R mysql.mysql /opt/mysql /var/lib/mysql -R

  1. 初始化数据库
[[email protected] ~]# /usr/local/mysql-5.6.36/scripts/mysql_install_db --user=mysql --datadir=/opt/mysql --basedir=/usr/local/mysql-5.6.36
[[email protected] ~]# cp /usr/local/mysql-5.6.36/support-files/mysql.server /etc/init.d/mysqld
[[email protected] ~]# chmod a+x /etc/init.d/mysqld 
  1. 配置文件
[[email protected] /usr/local/mysql-5.6.36]# cat my.cnf 
[mysqld]
basedir = /usr/loca/mysql
datadir = /opt/mysql
port = 3306
# server_id = .....
socket = /opt/mysql/mysql.sock
user=mysql
symbolic-links=0
innodb_file_per_table=1
max_connections=10000

[client]
port=3306
socket = /var/lib/mysql/mysql.sock

[mysqld_safe]
log-error=/usr/local/mysql/log/mysqld.log
pid-file=/tmp/mysql.sock
[[email protected] /usr/local/mysql-5.6.36]# 

[[email protected] /usr/local/mysql-5.6.36/log]# touch mysqld.log
[[email protected] /usr/local/mysql-5.6.36]# ./mysql.server start
Starting MySQL..... SUCCESS!

4. PHP部署

  1. 官网地址
  2. PHP各版本下载地址
  1. 软件环境依赖
[[email protected] ~]# yum -y install pcre pcre-devel openssl openssl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel  libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn-devel  openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison libevent automake libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel openjpeg bzip2 bzip2-devel
  1. 解压安装
[[email protected] /usr/local/src]# wget https://museum.php.net/php7/php-7.2.15.tar.gz
[[email protected] /usr/local/src]# tar xf php-7.2.15.tar.gz
[[email protected] /usr/local/src]# cd php-7.2.15
[[email protected] /usr/local/src/php-7.2.15]# ./configure --prefix=/apps/php-7.2.15 --with-config-file-path=/apps/php-7.2.15/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-pear --with-curl --with-png-dir --with-freetype-dir --with-iconv --with-mhash --with-zlib --with-xmlrpc --with-xsl --with-openssl --with-mysqli  --with-pdo-mysql --disable-debug --enable-zip --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-exif --enable-wddx --enable-bcmath --enable-calendar --enable-shmop --enable-dba --enable-sysvsem --enable-sysvshm --enable-sysvmsg  --enable-libxml --with-gd --with-jpeg-dir --with-bz2  --with-mcrypt  --enable-gd-native-ttf --enable-fastcgi --enable-pdo --enable-mbstring --enable-exif --enable-opcache --enable-mbregex  --enable-pcntl  --with-gettext --enable-session --enable-ctype  --enable-dom --with-libdir=lib64 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd  --disable-fileinfo
[[email protected] /usr/local/src/php-7.2.15]# make && make install

  1. 生成配置文件
[[email protected] ~]# cd /apps/php-7.2.15/etc/php-fpm.d/
[[email protected] /apps/php-7.2.15/etc/php-fpm.d]# cp www.conf.default www.conf
[[email protected] /apps/php-7.2.15/etc/php-fpm.d]# cp /usr/local/src/php-7.2.15/php.ini-production /apps/php-7.2.15/etc/php.ini
[[email protected] /apps/php-7.2.15/etc/php-fpm.d]# useradd www -s /sbin/nologin -u 1001
[[email protected] /apps/php-7.2.15/etc/php-fpm.d]# cat www.conf
[www]
user = www
group = www
listen = 127.0.0.1:9000
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 30
pm.min_spare_servers = 30
pm.max_spare_servers = 35
pm.status_path = /status
ping.path = /ping
ping.response = pong
access.log = log/$pool.access.log
slowlog = log/$pool.log.slow
[[email protected] /apps/php-7.2.15/etc/php-fpm.d]#
[[email protected] /apps/php-7.2.15/etc]# mkdir /apps/php-7.2.15/log
[[email protected] /apps/php-7.2.15/etc]# cp php-fpm.conf.default php-fpm.conf
[[email protected] /apps/php-7.2.15/etc]#
  1. 启动并验证php-fpm
[[email protected] ~]# /apps/php-7.2.15/sbin/php-fpm -t
[29-Jan-2021 13:59:28] NOTICE: configuration file /apps/php-7.2.15/etc/php-fpm.conf test is successful
# 验证php-fpm
[[email protected] ~]# /apps/php-7.2.15/sbin/php-fpm -c /apps/php-7.2.15/etc/php.ini

[[email protected] ~]# netstat -lntp |grep 9000
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      1630/php-fpm: maste

4.1 Nginx整合Php

  1. 准备测试页
[[email protected] ~]# cat /apps/nginx/html/index.php
<?php
 phpinfo();
?>
[[email protected] ~]#
  1. 整合php
[[email protected] ~]# cat /apps/nginx/conf/nginx.conf|egrep -v "#|^$"
user  nginx;
worker_processes  2;
worker_cpu_affinity 01 10;
error_log  /apps/nginx/logs/error.log  error;
pid        /apps/nginx/logs/nginx.pid;
worker_priority 0;
worker_rlimit_nofile 65536;
events {
     
   worker_connections  65536;
   use epoll;
   accept_mutex on;
   multi_accept on;
}
http {
     
   include       mime.types;
   default_type  application/octet-stream;
   
   log_format access_json '{"@timestamp":"$time_iso8601",'
      '"host":"$server_addr",'
      '"clientip":"$remote_addr",'
      '"size":$body_bytes_sent,'
      '"responsetime":$request_time,'
      '"upstreamtime":"$upstream_response_time",'
      '"upstreamhost":"$upstream_addr",'
      '"http_host":"$host",'
      '"uri":"$uri",'
      '"domain":"$host",'
      '"xff":"$http_x_forwarded_for",'
      '"referer":"$http_referer",'
      '"tcp_xff":"$proxy_protocol_addr",'
      '"http_user_agent":"$http_user_agent",'
      '"status":"$status"}';
    access_log /apps/nginx/logs/access_json.log access_json;
   sendfile        on;
   keepalive_timeout  65 65;
   server_tokens off;
   server {
     
       listen       80;
       server_name  localhost;
       charset utf-8;
       location / {
     
           root   html;
           index  index.php index.html index.htm;
           if ($http_user_agent ~ "ApacheBench|WebBench|TurnitinBot|Sogou web spider|Grid service"){
     
             return 403;
          }
       }
       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
     
           root   html;
       }
       location ~ \.php$ {
     
           root           html;
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
           include        fastcgi_params;
       }
   }
include /apps/nginx/conf/conf.d/*.conf;
}
[[email protected] ~]# 
  1. 重启nginx,验证php
[[email protected] ~]# /apps/nginx/sbin/nginx -t
nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
[[email protected] ~]# /apps/nginx/sbin/nginx -s reload

在这里插入图片描述

4.2 增加虚拟主机

  1. 修改配置文件,在配置文件增加虚拟主机,配置参数和虚拟主机一旦很多,很容易很长,采用多配置分开的模式如在nginx.conf http模块中引用
[[email protected] ~]# cd /apps/nginx/conf/
include /apps/nginx/conf/conf.d/*.conf;
  1. 增加虚拟主机访问节点配置
[[email protected] /apps/nginx/conf]# mkdir conf.d
[[email protected] /apps/nginx/conf/conf.d]# cat pc.conf 
server {
     
   listen       80;
   server_name  172.24.248.20;
 
   location / {
     
       root   /data/nginx/html/pc;
       index  index.html;
      
    }

    location /images {
     
       root /data/nginx/images;
       index index.html;
   }
   
    error_page 500 502 503 504 404 /error.html;
    location = /error.html{
     
       root html;
   }
  
}    
[[email protected] /apps/nginx/conf/conf.d]#

[[email protected] /data/nginx]# cat /data/nginx/images/index.html 
images
[[email protected] /data/nginx]# cat /data/nginx/html/pc/index.html 
pc  web
[[email protected] /data/nginx]# curl 172.24.248.20
pc  web
[[email protected] /data/nginx]# curl 172.24.248.20/images
images png

总结:
LNMP整体安装相对比较简单,而源码安装需要提前准备好源码包以及环境依赖。另外环境安装可以不需要过多去关注,更多的则是配置方面,因为安装好之后就不会在去处理,当然安装的方式分可选择自动化运维工具一键安装,也可以使用脚本一键安装。

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/chuangxinweike/article/details/113504022

智能推荐

前端设置条件限制form表单提交到后端解决方案_jsp前端页面将表单是否提交成功作为限制条件-程序员宅基地

文章浏览阅读375次。<script src="js/jquery-1.8.3.min.js" type="text/javascript"></script> <script type="text/javascript"> function checkName() { var name = document.getElementB..._jsp前端页面将表单是否提交成功作为限制条件

计算机网络sequence number,TCP协议中SequenceNumber和Ack Numbe-程序员宅基地

文章浏览阅读1k次。Sequence Numberlzyws7393074532892018-04-25Number Sequenceqq_391789932452017-09-21理解TCP序列号(Sequence Number)和确认号(Acknowledgment Number)hebbely9822017-01-14Number Sequence(规律)l25336363712902017-07-18Numb..._ack num

计算机系统启动项设置密码,电脑开机第一道密码怎么设置 - 卡饭网-程序员宅基地

文章浏览阅读5.9k次。笔记本电脑怎么进CMOS密码巧设置笔记本电脑怎么进CMOS密码巧设置 笔记本电脑为了保护用户的数据安全,往往采用加密的方式,最常见的还是CMOS密码加密技术。为了让你的重要数据更加安全,你可能需要设置不同的密码,这也就要求你记住许多密码。对于笔记本电脑用户来说,真的需要设置一道道密码关卡吗?非也非也! 一、认识与设置笔记本电脑的CMOS密码 笔记本电脑的CMOS密码大致分为超级密码(Supervi..._电脑第一道密码修改

VulnHub靶机-Jangow: 1.0.1_jangow01-程序员宅基地

文章浏览阅读2.5k次,点赞2次,收藏5次。迟到的文章,就当库存发出来吧~_jangow01

spark实战之RDD的cache或persist操作不会触发transformation计算_spark cache和persist不生效-程序员宅基地

文章浏览阅读1.7w次,点赞2次,收藏5次。默认情况下RDD的transformation是lazy形式,实际计算只有在ation时才会进行,而且rdd的计算结果默认都是临时的,用过即丢弃,每个action都会触发整个DAG的从头开始计算,因此在迭代计算时都会想到用cache或persist进结果进行缓存。敝人看到很多资料或书籍有的说是persist或cache会触发transformation真正执行计算,有的说是不会!敝人亲自实验了一把..._spark cache和persist不生效

html文字滚动_html滚动-程序员宅基地

文章浏览阅读2.4k次。HTML之marquee(文字滚动)详解语法:以下是一个最简单的例子:代码如下:Hello, World下面这两个事件经常用到:onMouseOut=“this.start()” :用来设置鼠标移出该区域时继续滚动onMouseOver=“this.stop()”:用来设置鼠标移入该区域时停止滚动代码如下:onMouseOut=“this.start()” :用来设置鼠标移出该区域时继续滚动 onMouseOver=“this.stop()”:用来设置鼠标移入该区域时停止滚动这是一个完_html滚动

随便推点

【汽车电子】浅谈车载系统QNX_车机qnx虚拟化软件系统架构-程序员宅基地

文章浏览阅读1.7k次。QNX是一种商用的遵从POSIX规范的类Unix实时操作系统,目标市场主要是面向嵌入式系统。它可能是最成功的微内核操作系统之一。QNX是一种商用的类Unix实时操作系统,遵从POSⅨ规范,目标市场主要是嵌入式系统[1]。QNX成立于1980年,是加拿大一家知名的嵌入式系统开发商。QNX的应用范围极广,包含了:控制保时捷跑车的音乐和媒体功能、核电站和美国陆军无人驾驶Crusher坦克的控制系统[2],还有RIM公司的BlackBerry PlayBook平板电脑。_车机qnx虚拟化软件系统架构

信号发生器设计VHDL代码Quartus仿真_vhdl正弦波信号发生器-程序员宅基地

文章浏览阅读1k次,点赞20次,收藏22次。代码功能:信号发生器设计信号发生器由波形选择开关控制波形的输出,分别能输出正弦波、方汉和三角波三种波形,波形的周期为2秒(由40M有源晶振分频控制)。考虑程序的容量,每种波形在一个周期内均取16个取样点,每个样点数据是8位(数值范围:00000000~1111111)要求将D/A变换前的8位二进数据(以十进制方式)输出到数码管动态演示出来。_vhdl正弦波信号发生器

笔记-Java线程概述_java 线程概述-程序员宅基地

文章浏览阅读629次。Java Concurrency in Practice中对线程安全的定义:当多个线程访问一个类时,如果不用考虑这些线程在运行时环境下的调度和交替运行,并且不需要额外的同步及在调用方代码不必做其他的协调,这个类的行为仍然是正确的,那么这个类就是线程安全的。显然只有资源竞争时才会导致线程不安全,因此无状态对象永远是线程安全的 。过多的同步会产生死锁的问题,死锁属于程序运行的时_java 线程概述

MATLAB从文件读取数据_matlab读取数据-程序员宅基地

文章浏览阅读1.2w次,点赞10次,收藏61次。读取表单Sheet2中部分信息。_matlab读取数据

【实践】基于spark的CF实现及优化_spark cf-程序员宅基地

文章浏览阅读1.4w次。最近项目中用到ItemBased Collaborative Filtering,实践过spark mllib中的ALS,但是因为其中涉及到降维操作,大数据量的计算实在不能恭维。所以自己实践实现基于spark的分布式cf,已经做了部分优化。目测运行效率还不错。以下代码package modelimport org.apache.spark.broadcast.Broadcastimp_spark cf

ijkplayer直播播放器使用经验之谈——卡顿优化和秒开实现_libijkplayer 播放直播流卡顿-程序员宅基地

文章浏览阅读1.8w次。 在我的博客移动平台播放器ijkplayer开源框架分析(以IOS源码为例),大致介绍了一下ijkplayer的基本函数调用顺序和主要线程作用,本博客想介绍一下在直播应用中,针对卡顿和秒开做的一些优化,本优化经验主要是用在Android系统上,ios上也可以借鉴,按本博客修改代码,网络带宽足够的情况下,音视频播放基本流畅不卡顿,首屏时间在500ms以内。 首先来看直播应用中的卡顿。直..._libijkplayer 播放直播流卡顿

推荐文章

热门文章

相关标签