您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
mongodb-短网址项目之完成项目
发布时间:2017-11-22 18:57:25编辑:雪饮阅读()
清除url表并为url字段添加唯一性索引
db.url.remove()(2.4.5版本中这种语法可以删除表中所有数据,而在2.6.6中则是db.url.remove({})才可以)
db.url.ensureIndex({url:1},{unique:true})
php源码也在上一实验基础上做了很多修改,详见附件的源码
将源码全部放到nginx1.0.15的html目录中
nginx配置修改两处
location / {
root html/short;
rewrite "/short/([a-zA-Z0-9]{3,7})" /index.php?id=$1;
index index.html index.htm;
}
location ~ \.php$ {
root html/short;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
重载nginx配置文件
/usr/local/nginx/sbin/nginx -s reload
修改host文件解析d.cn到你的nginx所在的虚拟机的局域网网ip上。
关键字词:mongodb,短网址