2013-08-03 81 views
0

我现在有一个nginx的设置与以下配置:窃听的nginx服务器

worker_processes 10; 

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


events { 
    worker_connections 4000; 
} 


http { 
    include  mime.types; 
    default_type application/octet-stream; 

    access_log off; 

    sendfile  on; 
    tcp_nopush  on; 

    #keepalive_timeout 0; 
    keepalive_timeout 30; 
    keepalive_requests 100000; 
     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 on; 
    gzip_min_length 10240; 
    gzip_proxied expired no-cache no-store private auth; 
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml; 
    gzip_disable "MSIE [1-6]\."; 
    # http server 
server { 
    proxy_pass_header 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; 

    ## 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$ { 
      root   html; 
      try_files $uri =404; 
      fastcgi_pass 127.0.0.1:9000; 
      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 on; 
      ## Set the OS file cache. 
      open_file_cache max=200000 inactive=20s; 
      open_file_cache_valid 30s; 
      open_file_cache_min_uses 2; 
      open_file_cache_errors on; 
     } 

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

# https server 
server { 
    listen 443 spdy ssl; 
    server_name localhost; 
    ssl_certificate  my.crt; 
    ssl_certificate_key my.key; 

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

    ## 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$ { 
      root   html; 
      try_files $uri =404; 
      fastcgi_pass 127.0.0.1:9000; 
      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 
} 

Web服务器似乎滞后。允许.htaccess定期下载,有时服务器端会出现错误(或者我怀疑),并且Web服务器将开始提供我没有请求或之前请求的页面(即使我明确要求index.php,我将被服务一些其他非相关页面)总体来说这是一个非常令人担忧的行为。

任何人都可以提供一些线索吗?

+0

”网络服务器将开始提供我没有请求的网页“ - 您是什么意思?还有哪个版本的nginx?您的操作系统是否完全更新/修补? – parry

+0

我在Windows Server 2012上运行nginx 1.5.2(我知道)。 – user2626019

回答

0

为了防止.HT *文件下载(前的.htaccess/htpasswd的),则必须将此行添加到您的配置

location ~ /\.ht   { access_log off; log_not_found off; deny all; } 

请确定您occurrently错误更准确的无定义的错误信息是不可能的给你一些建议。 “