ZF:nginx提供images/css/js/files,apache提供.php



嗨,我需要配置运行基于Zend Framework的应用程序的Web服务器:

我的想法是使用:nginx提供图像,文件(zip/doc/xls/…),js,html。。。apache为zf操作提供请求

我该如何设置?

thx大量

假设Apache在8080端口上运行,Nginx在80端口上运行。

您的静态文件位于/var/www/static/,那里的文件夹结构完全反映了预期的HTTP请求。

然后(随着你的一些特定上下文的变化),它可能是这样的:

upstream zend {
    server localhost:8080;
}
server {
    listen       80;
    server_name  frontend;
    location / {
        alias /var/www/static/;
        try_files $uri $uri/ @zend;
    }
    location @zend {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://zend;
    }
}

最新更新