Zend Framework 1.12 的 wnmp nginx 配置(Windows、nginx、mariadb、php 7)

wnmp nginx configuration for Zend Framework 1.12 (Windows, nginx, mariadb, php 7)

我有一个基于 zend framework 1.12 的站点,其 .htaccess 内容如下

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

我在windows7专业版上安装了wnmp来测试Windows、nginx、mariadb、php7

本地主机上的主页效果很好。 PHP 7 和 mariaDB 运行良好,在主页 localhost ( http://localhost )

上显示数据和图像

我尝试了很多东西,还有 Whosebug 的例子 Apache rewrite rule to NGINX for HHVM

我直接为主机提供的网址 喜欢 http://localhost/conference/sessions/date/2015-04/12/page/1 会议 - 控制器 会议 - 行动 请求参数日期和具有相应值的页面

这是我 nginx.conf

中的内容
worker_processes  1;

error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    # Max value 16384
    worker_connections  8192;
    # Accept multiple connections
    multi_accept on;
}

# Settings that affect all server blocks
http {
    include php_processes.conf;
    include       mime.types;
    default_type  application/octet-stream;

    access_log  logs/access.log;

    sendfile on;

    keepalive_timeout  65;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS; 
    ssl_prefer_server_ciphers on;
    gzip  on;
    # http server

# Begin HTTP Server
server {
    listen 80; # IPv4
    server_name localhost;

    ## Parametrization using hostname of access and log filenames.
    access_log logs/localhost_access.log;
    error_log logs/localhost_error.log;

    ## Root and index files.
    root html;
    index  index.php index.html index.htm;

    ## If no favicon exists return a 204 (no content error).
    location = /favicon.ico {
        try_files $uri =204;
        log_not_found off;
        access_log off;
    }

    ## Don't log robots.txt requests.
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    ## Try the requested URI as files before handling it to PHP.
    location / {

        ## Regular PHP processing.
        location ~ \.php$ {
            try_files  $uri =404;
            fastcgi_pass   php_processes;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        ## Static files
        location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
            expires max;
            log_not_found off;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
            ## Set the OS file cache.
            open_file_cache max=1000 inactive=120s;
            open_file_cache_valid 45s;
            open_file_cache_min_uses 2;
            open_file_cache_errors off;
        }

        ## Keep a tab on the 'big' static files.
        location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
            expires 30d;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
        }
        } # / location

} 
# End HTTP Server

# Begin HTTPS Server
server {
    listen 443 http2 ssl;
    server_name localhost;
    ssl_certificate      cert.pem;
    ssl_certificate_key  key.pem;
    ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;

    ## Parametrization using hostname of access and log filenames.
    access_log logs/localhost_access.log;
    error_log logs/localhost_error.log;

    ## Root and index files.
    root html;
    index  index.php index.html index.htm;

    ## If no favicon exists return a 204 (no content error).
    location = /favicon.ico {
        try_files $uri =204;
        log_not_found off;
        access_log off;
    }

    ## Don't log robots.txt requests.
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    ## Try the requested URI as files before handling it to PHP.
    location / {

        ## Regular PHP processing.
        location ~ \.php$ {
            try_files  $uri =404;
            fastcgi_pass   php_processes;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        ## Static files are served directly.
        location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
            expires max;
            log_not_found off;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
            ## Set the OS file cache.
            open_file_cache max=1000 inactive=120s;
            open_file_cache_valid 45s;
            open_file_cache_min_uses 2;
            open_file_cache_errors off;
        }

        ## Keep a tab on the 'big' static files.
        location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
            expires 30d;
            ## No need to bleed constant updates. Send the all shebang in one
            ## fell swoop.
            tcp_nodelay off;
        }
        } # / location
} # End HTTPS Server
}

请帮我解决这个问题;我是nginx的新手。

尝试在服务器配置中添加 server {...} 重定向到 index.php 用于未找到的资源

try_files $uri @missing;
location @missing {
    rewrite .* /index.php;
}

root ...; 应该指向包含 index.php

的 public 目录