七月 26th, 2010
一直以来都是使用svn+hook的组合部署vps上的php代码。这样的好处是不用每次更改代码后都要使用Ftp上传,而且还可以进行版本控制。
这种方式虽好,但有一点瑕疵。比如说你的网站在运行的过程中可能产生一些新文件。那么这些产生的文件不会反映在你本地的代码库里。更糟糕的是,如果程序还可以自行删除文件的话,久而久之会造成版本库的混乱,难以更新管理。
之所以想到dropbox是因为它不但能够同步两地文件,而且自身还有一定的版本控制功能。对于自己修改修改文件,维护维护程序,已经够用了。 Read the rest of this entry »
Tags: dropbox
Posted in linux, vps | No Comments »
七月 20th, 2010
配置文件中加入
location /
{
try_files $uri $uri/ /index.php?q=$uri&$args;
}
Tags: nginx, wrodpress
Posted in LNMP | No Comments »
七月 16th, 2010
两份配置中都只针对了/index.php这个页面。如果要对所有的路径应用php_info那么请将index.php中的配置移到 location ~ .*\.php(去掉后面的$)中即可。
0.7.13以下版本
server
{
listen 80;
server_name XXXXX.com;
index index.html index.htm index.php;
root /data/htdocs/dev;
location ~ .*\.php$
{
if ( $fastcgi_script_name ~ \..*\/.*php ) {
return 403;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location /
{
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
}
}
location ~ index\.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
include fastcgi_params;
}
log_format devlogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /data/logs/devlogs.log devlogs;
}
0.7.13以上版本可以使用新增的fastcgi_split_path_info指令。
server
{
listen 80;
server_name XXXX.com;
index index.html index.htm index.php;
root /data/htdocs/dev;
location ~ .*\.php$
{
if ( $fastcgi_script_name ~ \..*\/.*php ) {
return 403;
}
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
location /
{
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
}
}
#将index.php转发到fastcgi,增加了若干参数
location ~ index\.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
log_format devlogs '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /data/logs/devlogs.log devlogs;
}
因为要支持thinkphp,以上还包括了rewrite的配置。
Tags: nginx
Posted in LNMP | No Comments »