CubieTruck:Php+Nginx:修订间差异
imported>Soleverlee |
imported>Soleverlee |
||
第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> | ||
2016年9月1日 (四) 07:59的版本
安装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(); ?>