3 02 2021
Apache Streaming Server Install
아파치 mod_auth_token Module 설치
/app/httpd-2.2.27/bin
| 
					 1 2 3 4 5 6 7 8 9 10 11 12  | 
						[root@hae install]#cd /app/install/ [root@hae install]# wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mod-auth-token/mod_auth_token-1.0.5.tar.gz [root@hae install]# tar -xvfz mod_auth_token-1.0.5.tar.gz  [root@hae install]# cd mod_auth_token-1.0.5 [root@hae mod_auth_token-1.0.5]# rm -rf configure [root@hae mod_auth_token-1.0.5]# autoreconf -fi [root@hae mod_auth_token-1.0.5]#./configure --with-apxs=/app/httpd-2.2.27/bin/apxs [root@hae mod_auth_token-1.0.5]# make [root@hae mod_auth_token-1.0.5]# make install [root@hae mod_auth_token-1.0.5]#cd /app/httpd-2.2.27/modules [root@hae mod_auth_token-1.0.5]#ls -rwxr-xr-x  1 root root   29782 Feb  3 16:35 mod_auth_token.so  | 
					
위처럼 mod_auth_token.so 파일이 생성됩니다.
httpd.conf에서도 mod_auth_token.so등록되어 있습니다.
아파치 H264  Module 설치
yum install gcc
yum install httpd-devel
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | 
						[root@hae conf]# cd /app/install/ [root@hae install]# wget http://h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz [root@hae install]# tar -zxvf apache_mod_h264_streaming-2.2.7.tar.gz [root@hae install]# cd mod_h264_streaming-2.2.7/ [root@hae mod_h264_streaming-2.2.7]# ./configure --with-apxs=/app/httpd-2.2.27/bin/apxs [root@hae mod_h264_streaming-2.2.7]# make [root@hae mod_h264_streaming-2.2.7]# make install [root@hae httpd-2.2.27]# cd /app/httpd-2.2.27/modules [root@hae modules]# ls -al -rwxr-xr-x  1 root root  277786 Feb  3 17:16 mod_h264_streaming.so [root@hae conf]# cd /app/httpd-2.2.27/conf [root@hae conf]# vi httpd.conf    #Apache mod_h264 Streaming Server     AddHandler h264-streaming.extensions .mp4  | 
					
httpd.conf or   extra/httpd-vhost.conf
편집한다.
| 
					 1 2 3 4 5 6 7 8 9 10  | 
						<Location /downloads/> # Secret key, can be anything random  AuthTokenSecret "randomstring" # directory to protect  AuthTokenPrefix /downloads/ # Timeout length, this is in seconds  AuthTokenTimeout 300 # limit requsts by IP  AuthTokenLimitByIp off </Location>  | 
					
Java 프로그램 구현 소스
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  | 
						String secret="randomstring";                    // Same as AuthTokenSecret  String protectedPath="/downloads/";                   // Same as AuthTokenPrefix  //boolean ipLimitation=false;                     // Same as AuthTokenLimitByIp  long time= (new Date()).getTime();                // Time in decimal  time=time/1000;                                   // timestamp of java is longer than PHP   String hexTime =Long.toHexString(time);            // hexTime  in Hexadecimal    String token =getMD5( (secret+ filePathName + hexTime).getBytes());  return protectedPath +token+"/"+hexTime+ filePathName;  public String getMD5(byte[] source) {          String s = null;          char hexDigits[] = {           '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',   'e', 'f' };          try {                  java.security.MessageDigest md = java.security.MessageDigest                                  .getInstance("MD5");                  md.update(source);                  byte tmp[] = md.digest();                  char str[] = new char[16 * 2];                  int k = 0;                   for (int i = 0; i < 16; i++) {                           byte byte0 = tmp[i];                           str[k++] = hexDigits[byte0 >>> 4 & 0xf];                           str[k++] = hexDigits[byte0 & 0xf];                  }                  s = new String(str);           } catch (Exception e) {                  e.printStackTrace();          }          return s;  }  | 
					
Comments are currently closed.