20141226 更新
不要用這個~~因為不穩定~Orz
環境: Ubuntu 14.04.01
1. 安裝build deb需要的套件
1 |
apt-get install dpkg-dev |
- 創建source code目錄
1 2 |
mkdir -p /usr/src/nginx cd /usr/src/nginx |
- 透過apt-get下載nginx的source code
1 |
apt-get source nginx |
- 安裝git
1 |
apt-get install git |
- 透過git下載nginx-rtmp-module的source code
1 |
git clone https://github.com/arut/nginx-rtmp-module.git |
- 將rtmp、xlst模組功能加入設定檔中
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 |
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 <略> |
- 安裝nginx的相依性套件
1 |
apt-get build-dep nginx |
- 建置nginx deb
1 |
dpkg-buildpackage -b |
- 安裝編譯後的檔案
1 |
dpkg --install nginx-common_1.4.6-1ubuntu3.1_all.deb nginx-full_1.4.6-1ubuntu3.1_amd64.deb |
- 安裝php5-fpm、mysql-server、php5-mysql
1 |
apt-get install php5-fpm php5-mysql mysql-server |
- 修改nginx default site設定,加入php功能及相關host
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
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; #} } |
- 修改nginx設定,加入rtmp模組
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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; } } } |
- 重新啟動
1 |
service nginx restart |
- 下載xibo cms
1 2 3 4 |
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 |
- 設定存取權限
1 |
chown -R www-data:www-data . |
- 安裝php gd模組
1 |
apt-get install php5-gd |
- 安裝php mcrypt模組並啟動
1 2 |
apt-get install php5-mcrypt php5enmod mcrypt |
- 根據網頁顯示的建議,調整php.ini
You probably want to allow larger files to be uploaded than is currently available with your PHP configuration.
We suggest setting your PHP post_max_size and upload_max_size to at least 128M, and also increasing your max_execution_time to at least 120 seconds.
1 2 3 4 5 6 7 8 |
vim /etc/php5/fpm/php.ini <略> max_execution_time = 120 <略> post_max_size = 1024M <略> upload_max_filesize = 1024M <略> |
- 重新啟動nginx、php
1 2 3 4 5 |
service php5-fpm restart service nginx restart 20. 開啟網頁設定xibo 連結:http://{伺服器IP}/xibo |
- 設定時會詢問一個存放檔案的目錄,修改權限供nginx存取
1 2 |
mkdir /home/xibo chown -R www-data:www-data /home/xibo/ |
- 安裝完後登入測試
預設帳號 xibo_admin