0

A team member setup a virtual environment, ran something on port 8000 (and some other stuff that he may not be telling me) and now nginx will not start, even after reboot.

Start log from 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

And the contents of /etc/nginx/common/redis.conf are:

# 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;
}
User
  • 23,729
  • 38
  • 124
  • 207

1 Answers1

0

I think you don't have ngx_redis module installed. You can check it with:

nginx -V
Andrii Tarykin
  • 628
  • 3
  • 9
  • 26