CubieTruck:Php+Nginx:修订间差异
imported>Soleverlee |
imported>Soleverlee |
||
(未显示同一用户的3个中间版本) | |||
第1行: | 第1行: | ||
= | =安装nginx和php= | ||
<source lang="bash"> | <source lang="bash"> | ||
apt-get install nginx | apt-get install nginx | ||
apt-get install php5 php-pear php-fpm | |||
</source> | </source> | ||
=配置= | |||
修改/etc/nginx/sites-available/default | |||
<source lang="bash"> | |||
location ~ \.php$ { | |||
include snippets/fastcgi-php.conf; | |||
# | |||
# # With php5-cgi alone: | |||
# fastcgi_pass 127.0.0.1:9000; | |||
# # With php5-fpm: | |||
fastcgi_pass unix:/var/run/php5-fpm.sock; | |||
} | |||
</source> | |||
重启nginx: | |||
<source lang="bash"> | <source lang="bash"> | ||
/etc/init.d/nginx restart | |||
</source> | |||
=测试= | |||
在/var/www/html下新建一个index.php试试: | |||
<source lang="php"> | |||
<?php phpinfo(); ?> | |||
</source> | </source> | ||
页面如下: | |||
<pre> | |||
PHP Version 5.6.20-0+deb8u1 | |||
System Linux cubietruck 3.4.79 #1 SMP PREEMPT Thu Dec 25 09:30:25 CST 2014 armv7l | |||
Build Date Apr 27 2016 18:43:08 | |||
Server API FPM/FastCGI | |||
... | |||
</pre> | |||
=部署应用= | =部署应用= | ||
部署一个dokuwiki。 | |||
<source lang="bash"> | |||
apt-get install lrzsz | |||
rz #上传tgz包 | |||
tar -zxvf dokuwiki-3203a8fa2af3c3d5304bfdecb210ec5d.tgz | |||
mv dokuwiki w | |||
chown -R www-data:www-data w | |||
</source> | |||
注意其中的www-data是nginx的用户,在/etc/nginx/nginx.conf中有配置。然后访问localhost/w/install.php安装即可。 | |||
[[Category:Linux/Unix]] | [[Category:Linux/Unix]] |
2016年9月1日 (四) 08:21的最新版本
安装nginx和php
apt-get install nginx
apt-get install php5 php-pear php-fpm
配置
修改/etc/nginx/sites-available/default
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
重启nginx:
/etc/init.d/nginx restart
测试
在/var/www/html下新建一个index.php试试:
<?php phpinfo(); ?>
页面如下:
PHP Version 5.6.20-0+deb8u1 System Linux cubietruck 3.4.79 #1 SMP PREEMPT Thu Dec 25 09:30:25 CST 2014 armv7l Build Date Apr 27 2016 18:43:08 Server API FPM/FastCGI ...
部署应用
部署一个dokuwiki。
apt-get install lrzsz
rz #上传tgz包
tar -zxvf dokuwiki-3203a8fa2af3c3d5304bfdecb210ec5d.tgz
mv dokuwiki w
chown -R www-data:www-data w
注意其中的www-data是nginx的用户,在/etc/nginx/nginx.conf中有配置。然后访问localhost/w/install.php安装即可。