Back

给Discuz X1.5加上ssl支持

|

做个笔记:
之前把域名从name.com转到了NameCheap.com.
namecheap附赠了一个ssl证书, 想到这个[小论坛](http://bbs.skylast.com)里面有好多敏感词, 那么还是加上ssl吧, 我怀疑前几天的ip被屏蔽跟这个有关.
可是discuz对ssl是没有原生支持的, https可以打开页面, 却发现出现了好多莫名其妙的错误. 而chrome也提示网页含有非加密内容. 打开源代码一看, 发现好多静态内容都用的绝对路径. 去官方论坛搜了一下, 有人说修改路径为相对路径就行了..天, 那是多大的工作量.
后来发现[lanshunfang](http://blog.csdn.net/lanshunfang/archive/2011/04/22/6342630.aspx)的一篇博文, 人家还真是高人, 几条命令就解决问题了, 膜拜一下:
`` sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .htm$`
sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .php$`
sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .css$`
sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .xml$`
sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .js$`
sed -ir "s/http:/https:/g" `grep -rl "http:" ./ | grep .sql$` ``
由此可见, 学习Linux的道路是没有止境的.
还有一个bug, 论坛内的所有链接都被转发到443端口,导致500错误,lanshunfang提供了一个解决方法:
修改source/function/function\_core.php文件中的第1038行:
`$port = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':'.$_SERVER['SERVER_PORT'];`
为:
`$port='';`
即可.
最后, 一条新闻:
经最高人民法院核准 药家鑫6月7日上午被执行死刑. 来源: [凤凰网](http://news.ifeng.com/society/special/yaojiaxin/content-2/detail_2011_06/07/6858997_0.shtml)

No comments yet

Leave a comment

About me

I live in Tasmania, an island a little far from the rest of the world and very close to the sea.
Father of two little girls, have two puppies.

Work

Work in IT industry, AI is my working partner.