【发布时间】:2014-01-12 15:04:42
【问题描述】:
我正在从 Apache 切换到 Nginx,并且使用 apache,皮肤文件夹中的所有静态文件(图像、css、javascript)都由 Apache 直接提供。
例子:
DocumentRoot /zope/z_france_velo_tourisme/france-velo-tourisme/src
RewriteRule ^/images-fvt/(.*) /fvt.commun/fvt/commun/skins/fvt_commun_images/images-fvt/$1 [L]
我阅读了一些关于 Nginx 和 Plone 的文档,但我没有看到。这里是来自 Plone.org conf 的示例:https://github.com/plone/plone-org-nginx/blob/master/nginx.conf
所以,我的问题是:使用 Apache/Nginx 提供静态文件是否仍然是一种好习惯,如果是,如何使用 Nginx 来实现?
我尝试过这样的配置,但没有成功,我收到 404 错误:
root /zope/z_france_velo_tourisme/france-velo-tourisme/src;
rewrite ^/images-fvt/(.*)$ /fvt.commun/fvt/commun/skins/fvt_commun_images/images-fvt/$1;
我也试过这个(避免使用 root 指令)但也得到了 404:
rewrite ^/images-fvt/(.*)$ /zope/z_france_velo_tourisme/france-velo-tourisme/src/fvt.commun/fvt/commun/skins/fvt_commun_images/images-fvt/$1;
谢谢。
【问题讨论】:
-
首先我们在谈论什么虚拟服务器?
server_name localhost plone.org;? -
Apache/Nginx 在提供静态文件方面将比您的 Web 应用程序快得多。毕竟,快速提供文件是它的工作。
-
@MohammadAbuShady 是的,这个例子是克隆部分。
-
@MikeCauser 当然可以,但是我该怎么做呢?
标签: apache nginx rewrite plone