1.安装lnmp
sudo
apt-get update
sudo
apt-get
install
nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-cgi mysql-server
接下来我们来配置Nginx,首先打开配置文件,/etc/nginx/nginx.conf ,按照下面的配置进行修改。
user=root;
接下来打开/etc/nginx/sites-available/default也是按照下面的配置进行修改。
server {
listen 80;#Web服务端口号,大陆用户可能需要修改为81或8080等
server_name raspiweb.dyndns.org;
root /media/usb/www/;
access_log /var/log/nginx/localhost.access.log;
#error_page 404 /404.html;
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php$1 last;
}
location / {
index index.html index.htm index.php default.html default.htm default.php;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 1d;
}
location ~ .*\.php(\/.*)*$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
下面是对mysql的调优,打开配置文件/etc/mysql/my.cnf修改以下几处。
1
2
3
4
5
6
7
|
[mysqld]
key_buffer = 16k
max_allowed_packet = 1M
thread_stack = 64K
thread_cache_size = 4
query_cache_limit = 1M
default-storage-engine = MYISAM
|
最后我们来配置php.ini,php-fpm,打开配置文件/etc/php5/fpm/php.ini和/etc/php5/fpm/php-fpm.conf修改以下几处。
1
2
|
memory_limit=16M
process.max=4
|
到这里我们的lnmp环境配置已经大功告成!接下来是安装phpmyadmin到指定目录~这里只讲如何配置lnmp。
2.修改/etc/php5/fpm/pool.d/www.conf#user = www-data
#group = www-data
user = pi
group = pi
3. 修改/usr/share/nginx/www/目录权限
chgrp pi *
chown pi *
4.使用soap建设serve.php client.ph
<?php
//server端 serverSoap.php
$soap = new SoapServer(null,array('uri'=>"http://192.168.1.101/"));//This uri is your SERVER ip.
//$soap->addFunction('play'); //Register the function
$soap->addFunction(SOAP_FUNCTIONS_ALL);
$soap->handle();
function play($url,$dbusname){
// system("nohup omxplayer --dbus_name $dbusname $url &",$ret);
system("nohup omxplayer --live --threshold 2 $url &",$ret);
return $ret;
}
function control($str){
system("./dbuscontrol.sh $str",$ret);
return $ret;
}
?>
client.php内容
<?
$client = new SoapClient(null, array('location' =>"http://localhost/test/server.php",'uri' => "http://127.0.0.1/"));
echo $client->play($_GET["url"],$_GET["dbusname"]);
?>
备注:使用dbus-send命令控制omxplayer
pi@pi-102:/tmp$ ls
omxplayerdbus.pi omxplayerdbus.pi.pid
一定要是pi用户才行!!!!!!!!!