我得到一个“未知的指令”错误deny在我的nginx confg。
错误:
nginx: [emerg] unknown directive "deny" in /app/nginx/nginx.conf:22
configuration:
worker_processes 1; error_log stderr; pid nginx.pid; daemon off; events { worker_connections 768; } http { types_hash_max_size 2048; include mime.types; server { listen {{ $.PORT }}; server_name _; {{ if ne $.NGINX_ROOT "" }} root /app/www/{{ $.NGINX_ROOT }}; {{ else }} root /app/www; {{ end }} index index.html; # Deny all files by default location / { deny all; } # Allow access to specific files only location = / { } location = /favicon.ico { } location = /index.html { } location = /logo.png { } } }
感觉像我在这里错过了很明显的东西,但我只是没有看到它。 任何帮助赞赏。
编辑: nginx -V :
nginx version: nginx/1.10.1 built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configure arguments: --with-cpu-opt=generic --prefix=/tmp/build/nginx --with-pcre=../pcre-8.39 --sbin-path=. --pid-path=./nginx.pid --conf-path=./nginx.conf --with-ld-opt=-static --with-http_stub_status_module --with-http_gzip_static_module --with-file-aio --with-zlib=../zlib-1.2.8 --with-pcre --with-cc-opt='-O2 -static -static-libgcc' --without-http_charset_module --without-http_ssi_module --without-http_userid_module --without-http_access_module --without-http_auth_basic_module --without-http_autoindex_module --without-http_geo_module --without-http_map_module --without-http_split_clients_module --without-http_referer_module --without-http_proxy_module --without-http_fastcgi_module --without-http_uwsgi_module --without-http_scgi_module --without-http_memcached_module --without-http_empty_gif_module --without-http_browser_module --without-http_upstream_ip_hash_module --without-http_upstream_least_conn_module --without-http_upstream_keepalive_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module
根据注释,似乎您的Nginx版本不包含实现deny命令的http-access-module。