Discuz! X3 Portal Revamp Guide #2: Remote Image Localization Issues
Original Chinese title: discuz x3 门户改造手册2-图片本地的问题
-
I used a remote-image localization plugin whose main job is to automatically download external images in content pages and store them locally. When batch-saving, however, it kept hitting a 504 nginx timeout.
-
My first thought was FastCGI. After tweaking the parameters, the 504 error went away, yet none of the images were actually saved. So it wasn’t a FastCGI issue.
-
This stumped me for a few days. I SSH’d in to check the directories—image folders are named by date—and suddenly noticed that not even the folder for the localized images had been created.
ls -l -
That’s when I saw the image storage directory was owned by
root:root, while mywwwuser wasnginx:nginx. No wonder.chmod -R nginx:ginx / chmod -R 777 / -
Good old 777 saves the day again (lol). Still, it’s weird that the PHP script ran without throwing any errors or warnings—probably because PHP error reporting was turned off in production.
-
Pretty much it.
-
Testing an image host
[Archived image unavailable in 2013–2019 mirror: http://www.doubixie.com/images/st0-452.jpg]
-
用了一个远程图片本地化的插件,主要就是把内容页里面的外链图片都自动下载到本地存储。结果在批量存储的时候总是 504 nginx time-out。
-
首先想到是不是fastcgi的问题,设置了参数之后不会报504了,但是图片并没有存储下来。看来不是fastcgi的问题。
-
困扰了几天,ssh上看了看目录,图片目录的命名规则是按照时间来的,忽然发现需要本地化的图片连文件夹都没有建立。
ls -l -
然后就发现原来存图片的文件夹是
root:root的,而我的www用户是nginx:nginx。难怪chmod -R nginx:ginx / chmod -R 777 / -
果然还是777最好Ⅹ。但是比较奇怪的是php的程序都是执行了,也不会报错,也没有任何提示,估计是因为是正式环境里面把php的error给关了的缘故。
-
大致如此。
-
测试个图床
[Archived image unavailable in 2013–2019 mirror: http://www.doubixie.com/images/st0-452.jpg]