您好我需要配置运行基于 Zend 框架的应用程序的网络服务器:
我的想法是使用:nginx 来提供图像、文件(zip/doc/xls/...)、js、html、... apache 来提供对 zf 操作的请求
我该如何设置?
多谢
您好我需要配置运行基于 Zend 框架的应用程序的网络服务器:
我的想法是使用:nginx 来提供图像、文件(zip/doc/xls/...)、js、html、... apache 来提供对 zf 操作的请求
我该如何设置?
多谢
假设您的 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;
}
}