raspberry pi raspbian安装 lnmp nginx php mysql

作者:小鱼的互联网观察 发布时间:January 29, 2014 分类:linux

首先给pi安装 raspbian。

然后:sudo passwd root  修改root用户密码

然后exit

重新使用root用户登录。

接着运行下面的shell

sudo apt-get install mysql-server mysql-client
sudo apt-get install php5
sudo apt-get install php5-fpm php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
sudo apt-get install nginx


安装完毕后配置nginx

修改/etc/nginx/nginx.conf

在root权限命令行输入命令
nano /etc/nginx/nginx.conf
对照修改如下
开头部分
user www-data;
worker_processes 1; 修改这里
pid /var/run/nginx.pid;
events {
worker_connections 64; 修改这里
# multi_accept on;
}
继续向后找到gzip 去掉前面的注释 修改如下
gzip on;
gzip_disable “msie6″;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
Ctrol+O保存 Ctrl+X退出
在root权限命令行输入命令
nano /etc/php5/fpm/php.ini
找到这一段
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 32M 修改这里
找到这一段
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP’s
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=1 修改这里
在root权限命令行输入命令
nano /etc/php5/fpm/php-fpm.conf
找到这一段
; The maximum number of processes FPM will fork. This has been design to control
; the global number of processes when using dynamic PM within a lot of pools.
; Use it with caution.
; Note: A value of 0 indicates no limit
; Default Value: 0
process.max = 4 修改这里




完成以后重载各种服务
service nginx reload
service php5-fpm reload
service mysql reload




nano /etc/nginx/sites-enabled/default
找到这里 修改如下
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www;
# index index.html index.htm;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
在这句后面增加以下内容
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
找到这句
location ~ \.php$ {
连同后续内容修改如下
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;
}
至此配置修改完毕



标签: raspberry pi raspbian install lnmp nginx php mysql

互联网观察
raspberry pi raspbian安装 lnmp nginx php mysql
本文地址:https://tianmeng.org/archives/394/

相关文章

  • 无相关文章
文档信息

当前暂无评论 »

网站地图 京ICP证030173号