开发者社区> 问答> 正文

discuz3.1论坛使用oss存储图片和附件

我的服务器是ECS centos 6.5 32位系统


1.先安装oss ftp工具
https://help.aliyun.com/document_detail/32190.html
安装完毕要启动服务  
用screen命令新建一个窗口启动以后切换出去,这样就可以保证你退出putty以后服务还是运行着的



2.论坛后台设置远程附件
https://help.aliyun.com/document_detail/32191.html?spm=5176.bbsr284996.0.0.cHRFt6
这一步的说明
a3. FTP服务器地址填127.0.0.1 因为你的工具是安装在本台服务器上的
a9.访问域名可以填你自定义的那个访问oss的域名


注意:目录只能填.  不能使用其他的,我测试过了,使用其他的 虽然上传是正常的,但是访问的时候还是访问根目录,我也不知道改哪里,就用根目录算了
说明:附件上传是先上传到服务器,服务器再通过ftp上传到oss,访问的时候就是直接走oss 所以如果你的ecs不和oss在一个内网的话上传也是占用流量的,不过其实也没关系,就上传一次而已



3.把原来论坛里面的附件也上传到oss里面
附件分很多种,最最常见的就是论坛帖子里面的图片和附件了,我说下这个方法吧
先把data/attachment/forum/ 下面的所有文件夹剪切到oss对应的附件目录
然后执行下面的数据库语句
update pre_forum_attachment_0 set remote = '1'; update pre_forum_attachment_1 set remote = '1'; update pre_forum_attachment_2 set remote = '1'; update pre_forum_attachment_3 set remote = '1'; update pre_forum_attachment_4 set remote = '1'; update pre_forum_attachment_5 set remote = '1'; update pre_forum_attachment_6 set remote = '1'; update pre_forum_attachment_7 set remote = '1'; update pre_forum_attachment_8 set remote = '1'; update pre_forum_attachment_9 set remote = '1';
就可以了 再访问的时候就是从oss访问了


对于用户头像等其他地方的图片 暂时不敢弄,怕出问题
https://bbs.aliyun.com/simple/?t271101.html 数据库语句是从这个教程里面看到了,但是这个教程不适用于我的论坛



展开
收起
chainofhonor 2016-07-13 17:32:59 4903 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载