Nginx 存取設定

檔案 /usr/local/nginx/conf/nginx.conf

#在 http 模組下
        location / {
            root   html;
            index  index.html index.htm;
            # allowed ip list
            allow 192.168.0.0/24;
            #deny ip list
            deny all;
        }

        location /obs-remote {
            root  html;
            index index.html index.htm;
            # allowed ip list
            allow 192.168.0.0/24;
            #deny ip list
            deny  all;
        }

#在 rtmp 模組下
        application live {
            live on;
            record off;
            # allow publish streaming
            allow publish 192.168.0.0/24;
            # deny publish streaming
            deny publish all;
            # allow play
            allow play 192.168.0.0/24;
            # deny play
            deny play all;

修改後,執行 service nginx reload 重 load 設定檔
這邊都是設定 192.168.0.0/24 的 Lan 內才能觀看

Posted in Nginx | Leave a comment

Ubuntu x64 快速安裝 Nginx with RTMP module

#!/bin/sh
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev libxslt-dev -y
cd /tmp
wget http://nginx.org/download/nginx-1.7.3.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar -zxvf nginx-1.7.3.tar.gz 
apt-get install unzip -y
unzip master.zip 
cd nginx-1.7.3/
./configure --with-http_ssl_module --with-http_xslt_module --add-module=../nginx-rtmp-module-master
make
make install

cp /tmp/nginx-rtmp-module-master/stat.xsl /usr/local/nginx/html/
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak

echo " " >> /usr/local/nginx/conf/nginx.conf
echo "rtmp {" >> /usr/local/nginx/conf/nginx.conf
echo "        server {"  >> /usr/local/nginx/conf/nginx.conf
echo "                listen 1935;" >> /usr/local/nginx/conf/nginx.conf
echo "                chunk_size 4096;" >> /usr/local/nginx/conf/nginx.conf
echo " " >> /usr/local/nginx/conf/nginx.conf
echo "                application live {" >> /usr/local/nginx/conf/nginx.conf
echo "                        live on;" >> /usr/local/nginx/conf/nginx.conf
echo "                        record off;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #allow publish 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #deny publish all;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #allow play 127.0.0.1;" >> /usr/local/nginx/conf/nginx.conf
echo "                        #deny play all;" >> /usr/local/nginx/conf/nginx.conf
echo "                }" >> /usr/local/nginx/conf/nginx.conf
echo "        }" >> /usr/local/nginx/conf/nginx.conf
echo "}" >> /usr/local/nginx/conf/nginx.conf

# 這邊請複製 http://wiki.nginx.org/Nginx-init-ubuntu 內容至 nginx 檔案中
cd /etc/init.d/
vim nginx
chmod +x nginx

service nginx start
# service nginx start|stop|reload
Posted in Nginx, Ubuntu | Leave a comment

Nginx init script (Ubuntu)

將下列內容貼到 /etc/init.d/nginx 中,並且使用 chmod +x nginx 調整屬性

#! /bin/sh

### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid 
                --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid 
                --exec $DAEMON
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile 
                /usr/local/nginx/logs/$NAME.pid --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --pidfile 
                /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  reload)
      echo -n "Reloading $DESC configuration: "
      start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid 
          --exec $DAEMON
      echo "$NAME."
      ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
Posted in Nginx, Ubuntu | 1 Comment

Vim 設定tab space

vim ~/.vimrc
#加入下面
set ts=2
# ts => 1個tab佔幾個空格
set sw=2
# sw => 每層縮進的空格數
Posted in Vim | Leave a comment

Xshell 關閉擾人的警告音

Tools => Options => Advanced
勾選 Disable bell

Posted in Xshell | Leave a comment

VMware Player 設定NAT

  1. 確認VMware Player版本資訊
    ex: 6.0.3 build-1895310
    其中 6.0.3 就是最需要注意的

  2. 下載 VMware Workstation,因為VMware player是新版的,所以下載新版尾碼是.3的版本
    ex 10.0.3 build-1895310

  3. 進cmd執行 “VMware-workstation-full-10.0.3-1895310.exe /e .extact”
    此舉會將程式解壓縮至extact資料夾內

  4. 解壓縮extact內的core.cab,將其中的 “_vmnetcfglib.dll” 及 “vmnetcfg.exe” 複製到 VMware Player的安裝目錄下
    並將”_vmnetcfglib.dll”更名為”vmnetcfglib.dll”

Posted in VMware | Leave a comment

Flash Media Server (RTMP Server)

基本上裝完就可以跑了!!!
主要設定如下 (以下以OBS產生Streaming為例)
OBS設定 => 廣播
模式:直播串流
串流服務:Custom
伺服器:rtmp://[Flash Media Server 伺服器ip]:1935/livepkgr/
播放路徑:[變數]?adbe-live-event=liveevent

這時後便可以透過連結 rtmp://[Flash Media Server 伺服器ip]/livepkgr/[變數] 進行播放

Posted in FMS, RTMP | Leave a comment

Install Nginx with RTMP module in Ubuntu 12.04 x64 LTS

# 安裝必要套件
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

# 下載 tar 安裝檔案
cd /tmp
wget http://nginx.org/download/nginx-1.7.3.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

# 安裝 nginx
tar -zxvf nginx-1.7.3.tar.gz 
unzip master.zip 
cd nginx-1.7.3/
./configure --with-http_ssl_module --with-http_xslt_module --add-module=../nginx-rtmp-module-master
make
make install

# 編輯 nginx 設定檔案
vim /usr/local/nginx/conf/nginx.conf
rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

# 啟動 nginx service
/usr/local/nginx/sbin/nginx

此時可使用 OBS 傳送Stremaing進行測試
OBS設定 => 廣播
模式:直播串流
串流服務:Custom
伺服器:rtmp://[nginx 伺服器ip]/live
播放路徑:test

便可以透過VLC或是Flash player以下面連結進行播放
rtmp://[nginx 伺服器ip]/live

內嵌Flash Player的網頁範例如下




  
  Video.js RTMP Example - jsFiddle demo
  
  
   


  


Posted in Nginx, RTMP, Ubuntu | Leave a comment

Windows 7 convert MAK to KMS

先根據Windows 7版本輸入下述金鑰
Windows 7 Professional : FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional N : MRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Enterprise : 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise N : YDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise E : C29WB-22CC8-VJ326-GHFJW-H9DH4

啟用後再使用命令提示字元 (以管理員身分執行) 進行 slmgr 等指令

Posted in Windows | Leave a comment

關閉螢幕自動關閉

避免畫面會變黑

# vim /etc/profile
// 最後面加入下面這行
setterm -powersave off -blank 0

# sh /etc/profile
Posted in Linux | 1 Comment