手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:nginx

Nginx下zend framework的设置

由于zf自带的工具,生成的项目都是基于apache的,而nginx和apache的htaccess(即Rewriter规则)又不一样,而我自己又不会配置nginx,因此看到这个文章就复制以下,以备以后采用。

在Linux环境下增加一段虚拟服务器的设置,设置nginx.conf如下

XML/HTML代码
  1. server {  
  2.      listen 80;  
  3.      server_name audit.local;  
  4.      root /app/audit/public;  
  5.      access_log  /app/audit/logs/audit.access.log main;  
  6.      error_log   /app/audit/logs/audit.error.log;  
  7.      location / {  
  8.          index  index.php;  
  9.      # If file not found, redirect to Zend handling, we can remove the (if) here and go directly rewrite  
  10.          if (!-f $request_filename){  
  11.              rewrite ^/(.+)$ /index.php?$1& last;  
  12.          }  
  13.      }  
  14.      location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {  
  15.        access_log   off;  
  16.        expires      7d;  
  17.      }  
  18.      location ~ .*\.php?$ {  
  19.          fastcgi_pass   127.0.0.1:36;  
  20.          fastcgi_index  index.php;  
  21.          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;  
  22.          include        fastcgi_params;  
  23.      }  
  24.      error_page  404             http://audit.local/error;  
  25. }  
原文网址:http://www.jefflei.com/post/34.html

Tags: nginx

Records:11123