error nginx: директива [Emerg] "location" не разрешена здесь, в /etc/nginx/conf.d/wordpress_http.conf:23 nginx: configura - PullRequest
0 голосов
/ 28 мая 2020

в процессе установки ssl для моего сайта. Когда я перезапускаю nginx с помощью sudo service nginx restart, я сталкиваюсь с этой ошибкой

nginx: [Emerg] директива "location" не разрешена здесь, в / etc / nginx / conf.d / wordpress_http.conf: 23 nginx: configura

Это мои файлы wordpress_http.conf

Надеюсь, каждый поможет мне решить эту проблему. искренне благодарю

upstream php-handler-http {
    server 127.0.0.1:9000;
}
server {
        listen 80;
        server_name truyenfox.com www.truyenfox.com;
        return 301 https://truyenfox.com$request_uri;
        }
    root /var/www/html/;
    index index.php;

    # set max upload size
    client_max_body_size 2G;
    fastcgi_buffers 64 4K;

    access_log /var/log/nginx/wordpress_http_access.log combined;
    error_log /var/log/nginx/wordpress_http_error.log;

    server_tokens off;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    # protected area (XHProf)
    location ^~ /xhprof/xhprof_html/ {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/htpasswd/xhprof;

        location ~ \.php(?:$|/) {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PHP_FLAG "session.auto_start=off \n mbstring.encoding_translation=off";
          fastcgi_param PHP_VALUE "assert.active=0 \n mbstring.http_input=pass \n mbstring.http_output=pass";
          fastcgi_pass php-handler-http ;
          fastcgi_read_timeout 60s;
        }
    }

    # protected area (phpmyadmin)
    location ^~ /mysqladmin/ {
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/htpasswd/phpmyadmin;

        location ~ \.php(?:$|/) {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          fastcgi_param PHP_FLAG "session.auto_start=off \n mbstring.encoding_translation=off";
          fastcgi_param PHP_VALUE "assert.active=0 \n mbstring.http_input=pass \n mbstring.http_output=pass";
          fastcgi_pass php-handler-http ;
          fastcgi_read_timeout 60s;
        }
    }

    location ~* \.(htaccess|htpasswd) {
        deny all;
    }

    location ~ \.php(?:$|/) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PHP_VALUE "auto_prepend_file=/var/www/html/xhprof/external/header.php";
        fastcgi_pass php-handler-http;
        fastcgi_read_timeout 60s;
    }

    # set long EXPIRES header on static assets
    location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
        expires 30d;
        access_log off;
    }

}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...