树莓派 搭建一个nginx+php+mysql+dnspod动态解析 (转)
这次要搭建一个nginx+php+mysql+dnspod动态解析有路由器的么直接去路由器管理界面把树莓的mac绑定下,再映射这样会方便很多,不用担心ip变掉。首先sudo su获得root权限后操作会方便很多先apt-get update再apt-get install nginx php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql php5-cgi mysql-server安装期间会提示叫你输入数据库密码(这必须要记住..)[*]环境配置
在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) ;
<a href="http://php.net/memory-limit" target="_blank">http://php.net/memory-limit </a>
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.
;<a href="http://php.net/cgi.fix-pathinfo" target="_blank">http://php.net/cgi.fix-pathinfo </a>
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修改这里接着改nginxnano /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 ipv6root /home/pi/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;
}完成之后重新加载服务service nginx reload
service php5-fpm reload
service mysql reload接下来安装phpmyadminmkdir /home/pi/www
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.7/phpMyAdmin-3.5.7-all-languages.zip<a href="http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.7/phpMyAdmin-3.5.7-all-languages.zipunzip" target="_blank">
</a>punzipphpMyAdmin-3.5.7-all-languages.zip最后给文件夹权限chown www-data:www-data /home/pi/www -R
chmod 755 /home/pi/www -R最后是dnspod的设置https://gist.github.com/chuangbo/833369这里已有源代码
需要修改的地方如下params = dict(
login_email="email", # dnspod的邮箱
login_password="password", # 你的密码
format="json",
domain_id=100, #domain_id <a href="http://geekpi.cn/dnspod" target="_blank">http://geekpi.cn/dnspod</a>域名编号去左边的连接获取
record_id=100, # record_id 记录id同上,子域名前面的编号
sub_domain="www", # 你想要解析的子域名
record_line="默认",
)保存为dnspod.py
然后输入 nohup python main.py &
就已经在后台运行了按ctrl+c也不会退出,只有用kill才能删除进程演示pi.isdiary.com转自:http://www.isdiary.com/2013/04/490
推荐个LNMP一键安装包 lnmp.org lin_toto 发表于 2013-4-24 19:46 static/image/common/back.gif
推荐个LNMP一键安装包 lnmp.org
这个还得编译,几小时都不知道能不能装上。 dnspod动态解析 这个没会。。。
页:
[1]