Nginx下配置zend framework

发布时间:2019-11-01编辑:脚本学堂
nginx下配置zend framework,可以在Linux环境下增加一段虚拟服务器的设置,设置nginx.conf如下:

nginx下配置zend framework,可以在linux环境下增加一段虚拟服务器的设置,设置nginx.conf如下:
  

复制代码 代码如下:
server {
        listen 80;
        server_name audit.local;
        root /app/audit/public;
        access_log  /app/audit/logs/audit.access.log main;
        error_log   /app/audit/logs/audit.error.log;
        location / {
            index  index.php;
        # If file not found, redirect to Zend handling, we can remove the (if) here and go directly rewrite
            if (!-f $request_filename){
                rewrite ^/(.+)$ /index.php?$1& last;
            }
        }
        location ~* ^.+.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
          access_log   off;
          expires      7d;
        }
        location ~ .*.php?$ {
            fastcgi_pass   127.0.0.1:36;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
        error_page  404   http://audit.local/error;
   }