nginx:在/etc/nginx/sites-enabled/wiki.[site].com:48中,此处不允许[emerg]“上游”指令。

时间:2018-08-02 16:19:07

标签: php nginx mediawiki

我正在尝试使用Nginx配置mediawiki实例。我以前在另一台服务器上做过,在那儿工作正常。但是,当我将相同的nginx虚拟主机文件复制到此服务器(更改server_name之类的相对位)时,nginx给了我以下错误:

nginx: [emerg] "upstream" directive is not allowed here in /etc/nginx/sites-enabled/wiki.[site].com:48

在我的另一台服务器上,这完全没有错误,并且完全按预期工作。我在两台服务器上都使用相同版本的nginx(1.14),并且nginx.conf文件是相同的。

我很沮丧,任何帮助将不胜感激。

完整的虚拟主机文件如下:

    server{
            listen 80;
    listen [::]:80;
    server_name wiki.[site].work;
        return 301 https://wiki.[site].work$request_uri;
}

server {
    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot

    server_name wiki.[site].work;
    root /var/www/wiki.[site].work;
    index index.php;
    autoindex off;


    ssl_certificate /etc/letsencrypt/live/[site].work/cert.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/[site].work/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    client_max_body_size 5m;
    client_body_timeout 60;

    location / {
        index index.php5;
        rewrite ^/([^?]*)(?:\?(.*))? /index.php5?title=$1&$2 last;
    }
    location ~ \.php5?$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass php5-fpm-sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
fastcgi_param HTTPS on;
}

    location ~ \.php?$ {
        try_files $uri =404;
fastcgi_param HTTPS on;
   include fastcgi_params;
        fastcgi_pass php5-fpm-sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
    }

    upstream php5-fpm-sock {
        server unix:/var/run/php5-fpm.soc;
fastcgi_param HTTPS on;
}

}

0 个答案:

没有答案