4

我试图禁用 nginx 缓存。我正在使用 Wnmp ( https://bitbucket.org/x64architecture/windows-nginx-mysql-php ),每次我重新加载任何 php 文件时,我都需要等待几分钟才能使更改反映在浏览器上。我试图对 nginx.conf 进行一些更改,但没有成功。这是我的 nginx.conf:

worker_processes  1;

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

events {
    worker_connections  1024;
}
http {
include       mime.types;
default_type  application/octet-stream;

access_log  logs/access.log;

sendfile        off;

#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  30;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
    ssl_ciphers ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH; 
    ssl_prefer_server_ciphers on;
gzip  off;
server {
listen 80; # IPv4
server_name localhost;

## Parameterization 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;

location / {
    try_files $uri $uri/ /index.php?r=$request_uri;
    expires -1;
}

location ~ ^/(protected|framework|themes/\w+/views) {
    deny  all;
}

#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    try_files $uri =404;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~* \.html$ {
expires -1;
}
location ~ \.php {
    fastcgi_split_path_info  ^(.+\.php)(.*)$;

    #let yii catch the calls to unexising PHP files
    set $fsn /;
    if (-f $document_root$fastcgi_script_name){
        set $fsn $fastcgi_script_name;
    }

    fastcgi_pass   127.0.0.1:9000;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;

    #PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
    fastcgi_param  PATH_INFO        $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED  $document_root$fsn;

expires -1;
}
    # prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.)
    location ~ /\. {
         deny all;
         access_log off;
         log_not_found off;
    }
} # end http server
}

谢谢

4

1 回答 1

2

解决了我的问题...按照以下步骤手动安装:http://eksith.wordpress.com/2008/12/08/nginx-php-on-windows/ 使用纯 nginx 我可以禁用 nginx.conf 上的缓存

于 2013-09-11T11:34:39.163 回答