即使代码正确,nginx.conf文件也不会重新启动

时间:2019-01-05 20:04:07

标签: wordpress ubuntu nginx

因此,我在Vultr上托管了Ubuntu上的wordpress网站。我安装了SSL证书,将http重定向到https,但是有2个问题。

  1. 即使我在domain.conf和.htaccess文件中具有正确的代码,我的http://example.com也没有重定向到https://www.example.com
  2. 由于此错误,我无法重新启动nginx:

我已经尝试过以各种方式重新启动它以及尝试清除代码,但是没有可疑之处引起了我的注意。

Jan 05 19:56:08 example.com systemd[1]: Starting A high performance 
web server and a reverse proxy server...
Jan 05 19:56:08 example.com nginx[10841]: nginx: [emerg] unknown " 
vary_header" variable
Jan 05 19:56:08 example.com nginx[10841]: nginx: configuration file 
/etc/nginx/nginx.conf test failed
Jan 05 19:56:08 example.com systemd[1]: nginx.service: Control process 
exited, code=exited status=1
Jan 05 19:56:08 example.com systemd[1]: Failed to start A high 
performance 
web server and a reverse proxy server.
Jan 05 19:56:08 example.com systemd[1]: nginx.service: Unit entered 
failed state.
Jan 05 19:56:08 example.com systemd[1]: nginx.service: Failed with 
result 'exit-code'.
root@example:~#

1 个答案:

答案 0 :(得分:0)

user www-data;
worker_processes auto;
worker_rlimit_nofile 100000;
pid /run/nginx.pid;

events {
        worker_connections 4096;
        multi_accept on;
}

http {
        ##
        # EasyEngine Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 30;
        types_hash_max_size 2048;

        server_tokens off;
        reset_timedout_connection on;
        add_header X-Powered-By "SPDYWP.COM";
        add_header Blade-Cache $upstream_cache_status;

        # Limit Request
        limit_req_status 403;
        limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

        # Proxy Settings
        # set_real_ip_from      proxy-server-ip;
        # real_ip_header        X-Forwarded-For;
        fastcgi_read_timeout 300;
        client_max_body_size 100m;
##
    # Gzip Settings
    ##

    # Enable Gzip compression
    gzip on;
  # Do NOT compress anything smaller than 256 bytes
    gzip_min_length 256;

    # Fuck IE6
    gzip_disable "msie6";
        ##
        # SSL Settings
        ##

        ssl_session_cache shared:SSL:20m;
        ssl_session_timeout 10m;
        ssl_prefer_server_ciphers on;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-$
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

        ##
        # Basic Settings
 ##
        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;
        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        # Log format Settings
        log_format rt_cache '$remote_addr $upstream_response_time $upstream_cache_status [$time_local] '
        '$http_host "$request" $status $body_bytes_sent '
        '"$http_referer" "$http_user_agent"';


        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#       #mail {
#       # See sample authentication script at: