繁体   English   中英

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]

我在Windows 7 Professional上安装了wnmp以测试Windows,nginx,mariadb,php7

本地主机上的主页效果很好。 PHP 7和mariaDB运作良好,并在主页localhost( http:// localhost )上显示了数据和图像。

我也尝试了很多事情,包括stackoverflow的示例Apache重写规则到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公共目录

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM