2

Good day!

I have a forum configured with MyBB. Everything was up and running in Ubuntu 14.04, but my friend tried to install 16.04 on it and first saved everything (site's config, letsencrypt files, site's files, database dump, etc.). He could have done sudo do-release-upgrade, but no, he prefered to backup everything and do a clean install.

The thing is I have now the task of put everything in order, and now with an sudo nginx -t I get this syntax error:

nginx: [emerg] no port in upstream "memcached" in /etc/nginx/sites-enabled/forum.example.com:54

Checking above that line 54, I see "$scheme://$host$request_uri", which must have been previously configured in the nginx.conf file... which he forgot to backup.

I have a memcached server, what I don't know is how/where to declare it. It's in nginx,conf, or in the site's .conf file?

Let me know.

Here's the rest of the configuration. Is there any other thing wrong there?

Thanks in advance.

Warm regards.

server {
     listen 80;
     server_name forum.example.com;
     return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name forum.example.com;

location ~ \.css {
    add_header  Content-Type    text/css;
}

location ~ \.js {
    add_header  Content-Type    application/x-javascript;
}

    root /usr/share/nginx/html/forum;

    ssl on;
    ssl_certificate     /etc/letsencrypt/live/forum.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/forum.example.com/privkey.pem;
    ssl_session_timeout 5m;
    ssl_ciphers               'AES128+EECDH:AES128+EDH:!aNULL';
    ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access-forum.log;
    error_log /var/log/nginx/error-forum.log;
    client_max_body_size 10m;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

location / {
        index index.php index.htm index.html;
        try_files $uri $uri/ /index.php?q=$uri&$args;
        }

location ~ \.php$ {
        set $memcached_key "$scheme://$host$request_uri";
        memcached_pass memcached;
        default_type       text/html;
        error_page 404 405 502 = @cache_miss;
        }

location @cache_miss {
        if (!-f $request_filename) { return 404; }
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;

fastcgi_read_timeout 300;
}

location = /memcache.php {
        if (!-f $request_filename) { return 404; }
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        fastcgi_read_timeout 300;
        }
}
Alain
  • 135
  • 3

0 Answers0