0

一个团队成员设置了一个虚拟环境,在端口 8000 上运行了一些东西(以及一些他可能没有告诉我的其他东西),现在 nginx 将无法启动,即使在重新启动后也是如此。

从以下开始日志journalctl -xn

-- Unit nginx.service has begun starting up.
Mar 03 18:39:23 digitalocean nginx[954]: nginx: [emerg] unknown directive "redis_pass" in /etc/nginx/common/redis.conf:27
Mar 03 18:39:23 digitalocean nginx[954]: nginx: configuration file /etc/nginx/nginx.conf test failed
Mar 03 18:39:23 digitalocean systemd[1]: nginx.service: control process exited, code=exited status=1
Mar 03 18:39:23 digitalocean systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed

内容/etc/nginx/common/redis.conf是:

# Redis NGINX CONFIGURATION
# DO NOT MODIFY, ALL CHANGES LOST AFTER UPDATE EasyEngine (ee)
set $skip_cache 0;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
  set $skip_cache 1;
}
if ($query_string != "") {
  set $skip_cache 1;
}
# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
  set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenter or customer with items in cart
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart") {
  set $skip_cache 1;
}
# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
  try_files $uri $uri/ /index.php?$args;
}

location /redis-fetch {
    internal  ;
    set  $redis_key $args;
    redis_pass  redis;
}
location /redis-store {
    internal  ;
    set_unescape_uri $key $arg_key ;
    redis2_query  set $key $echo_request_body;
    redis2_query expire $key 14400;
    redis2_pass  redis;

}

location ~ \.php$ {
  set $key "nginx-cache:$scheme$request_method$host$request_uri";
  try_files $uri =404;

  srcache_fetch_skip $skip_cache;
  srcache_store_skip $skip_cache;

  srcache_response_cache_control off;

  set_escape_uri $escaped_key $key;

  srcache_fetch GET /redis-fetch $key;
  srcache_store PUT /redis-store key=$escaped_key;

  more_set_headers 'X-SRCache-Fetch-Status $srcache_fetch_status';
  more_set_headers 'X-SRCache-Store-Status $srcache_store_status';

  include fastcgi_params;
  fastcgi_pass php;
}
4

1 回答 1

0

我认为您没有安装 ngx_redis 模块。您可以通过以下方式进行检查:

nginx -V
于 2017-06-28T19:38:26.167 回答