修改檔案 {xibo}/lib/app/thememanager.class.php
$item['li'] = '
修改為
$item['li'] = '
修改檔案 {xibo}/lib/app/thememanager.class.php
$item['li'] = '
修改為
$item['li'] = '
20141226 更新
不要用這個~~因為不穩定~Orz
環境: Ubuntu 14.04.01
1. 安裝build deb需要的套件
apt-get install dpkg-dev
mkdir -p /usr/src/nginx
cd /usr/src/nginx
apt-get source nginx
apt-get install git
git clone https://github.com/arut/nginx-rtmp-module.git
cd nginx-1.4.6/
vim debian/rules
<略>
common_configure_flags :=
--with-cc-opt="$(debian_cflags)"
--with-ld-opt="$(debian_ldflags)"
--prefix=/usr/share/nginx
--conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi
--with-debug
--with-pcre-jit
--with-ipv6
--with-http_ssl_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_xslt_module
--add-module=/usr/src/nginx/nginx-rtmp-module
<略>
apt-get build-dep nginx
dpkg-buildpackage -b
dpkg --install nginx-common_1.4.6-1ubuntu3.1_all.deb nginx-full_1.4.6-1ubuntu3.1_amd64.deb
apt-get install php5-fpm php5-mysql mysql-server
vim /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name xibo;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location /obs-remote {
root html;
index index.html index.htm;
#allow
#deny all;
#auth_basic "Restricted Area";
#auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
}
location /stat {
rtmp_stat all;
# Use this stylesheet to view XML as web page
# in browser
rtmp_stat_stylesheet stat.xsl;
#auth_basic "Restricted Area stat";
#auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root html;
# auth_basic "Restricted Area stat.xsl";
# auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}
vim /etc/nginx/nginx.conf
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
#allow publish 10.0.0.0/8;
#deny publish all;
#allow play 10.201.80.107;
#deny play all;
}
}
}
service nginx restart
cd /usr/share/nginx/html
wget https://launchpad.net/xibo/1.6/1.6.4/+download/xibo-server-164.tar.gz
tar zxvf xibo-server-164.tar.gz
mv xibo-server-164 xibo
chown -R www-data:www-data .
apt-get install php5-gd
apt-get install php5-mcrypt
php5enmod mcrypt
vim /etc/php5/fpm/php.ini
<略>
max_execution_time = 120
<略>
post_max_size = 1024M
<略>
upload_max_filesize = 1024M
<略>
service php5-fpm restart
service nginx restart
20. 開啟網頁設定xibo
連結:http://{伺服器IP}/xibo
mkdir /home/xibo
chown -R www-data:www-data /home/xibo/
因為原本 wisemapping 搭配的是 immediatenet 提供的網頁縮圖服務
測試的失敗率有點高~主要還是因為不支援 https 的原因
所以使用 page2images 提供的服務取代掉
{wisemapping home directory}/webapps/wisemapping/js/mindplot-min.js
<略>
//註解掉舊有的設定
//var d=new Element("img",{src:"http://immediatenet.com/t/m?Size=1024x768&URL="+b.getModel().getUrl(),img:b.getModel().getUrl(),alt:b.getModel().getUrl()});
//var d=new Element("img",{src:"http://free.pagepeeker.com/v2/thumbs.php?size=m&refresh=1&url="+b.getModel().getUrl()});
//設定 function 以便取得連結相關資訊
//包含hostname、pathname等
var cowgetLocation = function(href) {
var cowl = document.createElement("a");
cowl.href = href;
return cowl;
}
//取得正確連結,並去掉 http:// 及 https://
var cowl = cowgetLocation(b.getModel().getUrl());
//console.log(cowl.hostname);
//console.log(cowl.pathname.length);
if (cowl.pathname.length > 1) {
var cowimgurl = cowl.hostname + cowl.pathname;
} else {
var cowimgurl = cowl.hostname;
}
//使用 page2images 申請提供的 api 進行縮圖
//var d=new Element("img",{src:"http://api.page2images.com/directlink?p2i_url="+b.getModel().getUrl()+"&p2i_key=1716358728d706ce"});
var d=new Element("img",{src:"http://api.page2images.com/directlink?p2i_url="+ cowimgurl +"&p2i_key=1716358728d706ce"});
//console.log(b.getModel().getUrl());
//console.log(cowimgurl);
<略>
後來發現 wisemapping 提供的 api doc 網站還不錯
功能都有了,包含查詢、刪除等功能
只是測試的時候要小心,因為資料真的會被刪掉….Orz
網址 link:http://{伺服器IP}/map/doc/rest/index.html
因為 wisemapping 預設使用 8080 port
etherpad 預設使用 9001 port
都很麻煩~~所以就使用 nginx proxy 幫忙轉址了
以下是測試很久的設定檔
location /pad {
rewrite ^/pad(/.*)$ $1 break;
proxy_pass http://localhost:9001/;
proxy_set_header Host $host;
proxy_buffering off;
access_log /var/log/nginx/etherpad.log;
error_log /var/log/nginx/etherpad.log;
}
location /map {
#rewrite ^/map(/.*)$ $1 break;
proxy_pass http://localhost:8080/map;
proxy_set_header Host $host;
proxy_buffering off;
access_log /var/log/nginx/wisemapping.log;
error_log /var/log/nginx/wisemapping.log;
}
配合這個設定
etherpad 需要設定 {etherpad home directory}/settings.json
//略
//IP and port which etherpad should bind at
"ip": "127.0.0.1",
"port" : 9001,
/*when you use NginX or another proxy/ load-balancer set this to true*/
"trustProxy": true,
//略
wisemapping 要設定的地方比較多….
{wisemapping home directory}/webapps/wisemapping/WEB-INF/app.properties
<略>
site.baseurl = http://{伺服器IP}/map
<略>
documentation.services.basePath=http://{伺服器IP}/map/service
<略>
{wisemapping home directory}/contexts/wisemapping.xml
<略>
<略>
/map
<略>
受教了~修正 etherpad 的日期顯示以 “yyyy-mm-mm hh-mm” 顯示的過程中發現月份總是少一個月
可是看 code 又沒有什麼問題
所以用 google 搜尋 “jquery + 少1個月” 及 “javascript + 少1個月” 發現了是 javascript 對於月份是少一個月 Orz…
所以 etherpad 的原本的寫法還不錯,貼上來註記一下
var converterPad = function (UNIX_timestamp) {
var a = new Date(UNIX_timestamp);
//原本的寫法是用英文顯示
//var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
//後來改以數字顯示
var months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
var year = a.getFullYear();
var month = months[a.getMonth()];
//這邊是原本想直接用function直接抓值,結果發現都少一個月,只好自己加1
//var temp = a.getMonth() + 1;
//var month = (( temp + 1 < 10) ? "0" : "") + temp;
var date = (( a.getDate() < 10) ? "0" : "") + a.getDate();
var hour = (( a.getHours() < 10) ? "0" : "") + a.getHours();
var min = ((a.getMinutes() < 10) ? "0" : "") + a.getMinutes();
//return date + '. ' + month + ' ' + year + ' ' + hour + ':' + min + ' ';
return year + '-' + month + '-' + date + ' ' + hour + ':' + min;
};
最近在測試upstart開機自動啟動服務時遇到一個麻煩…
一直告訴我無法access該目錄….
以為是upstart寫錯~一值修正…
後來才發現是目錄被加密……所以無法被access…
記起來,下次要小心
/home/cowman/.Private on /home/cowman type ecryptfs (ecryptfs_check_dev_ruid,ecryptfs_cipher=aes,ecryptfs_key_bytes=12,ecryptfs_unlink_sigs,ecryptfs_sig=123,ecryptfs_fnek_sig=123)
這邊先貼幾個基本的,在etherpad及wisemapping建置的時候使用的conf來看一下
/etc/init/etherpad.conf
description "etherpad"
#start on started networking
start on started mysql
stop on runlevel [!2345]
env EPHOME=/home/etherpad/etherpad-lite
env EPLOGS=/var/log/etherpad-lite
env EPUSER=etherpad
respawn
pre-start script
cd $EPHOME
mkdir $EPLOGS ||true
chown $EPUSER:admin $EPLOGS ||true
chmod 0755 $EPLOGS ||true
chown -R $EPUSER:admin $EPHOME/var ||true
$EPHOME/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
end script
script
cd $EPHOME/
exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node node_modules/ep_etherpad-lite/node/server.js
>> $EPLOGS/access.log
2>> $EPLOGS/error.log
end script
/etc/init/wisemapping.conf
description "Wisemapping Service"
author "cowman"
start on started mysql
stop on runlevel [!2345]
env WHOME=/wisemapping
env WLOGS=/var/log/wisemapping
expect fork
pre-start script
chdir $WHOME
mkdir $WLOGS ||true
end script
respawn
script
chdir $WHOME
java -Xms512m -Xmx1024m -Dorg.apache.jasper.compiler.disablejsr199=true -jar $WHOME/start.jar
>> $WLOGS/wisemapping.log
2>> $WLOGS/error.log
emit wisemapping_running
end script
當conf檔案放入/etc/init後便可以透過以下指令進行
start {service name}
stop {service name}
restart {service name}
status {service name}
以下大概作個說明
description "描述說明"
author "作者名稱"
start on [程序]
# start on started mysql <= 等 mysql 啟動完畢在啟動
# start on runlevel [345] <= 伴隨系統runlevel設定一起啟動
# 說明請見 http://upstart.ubuntu.com/cookbook/#runlevels
stop on [程序]
env 環境變數
expect fork #保護程序
pre-sstart script # 啟動預備程序
<內容>
chdir 目錄 # 切換目錄
end script
respawn # 當程序崩潰時重新啟動
script # 主程序
內容
end script
更詳細的說明可以參考 http://blog.fens.me/linux-upstart/
因為預設的bridge firewall ploicy是bypass…屬於通透的firewall (layer 2)
所以在layer 3的iptables就管不到他了
這時候可以修正 /etc/sysctl.conf 內的設定,增加下面的資料
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-arptables = 1
然後使用 sysctl -p /etc/sysctl.conf 執行
也可以透過 sysctl -a | grep bridge-nf 觀看目前相關設定