NGINX位置指令无法响应服务重启

时间:2015-09-16 17:21:05

标签: wordpress nginx server mediatemple

我有一个中型到大型的WordPress网站运行MediaTemple NGINX服务器,而CENTOS和我无法应用任何位置块属性。目标是锁定目录,以便只有服务器才能访问它。从我看过的所有东西,我正在设置的根和位置块被正确调用,它们似乎没有被注意到。

#user  nginx;

worker_processes  24;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    # rewrite_log on;
    include   mime.types;
    default_type  application/octet-stream;
    access_log  /var/log/nginx/access.log;
    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  3;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)”;

    index index.php index.html index.htm

    server_tokens off;

    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;

    include /etc/nginx/conf.d/*.conf;
    include fastcgi.conf;

    server {
      listen 80;
      server_name domainname.com;
      rewrite ^ $scheme://www.domainname.com$request_uri redirect;
    }

    server {
      listen 80;
      server_name www.domainname.com;
      root /var/www/vhosts/domainname.com/httpdocs;

      # Additional rules go here.
      location ^~ /protected-folder/ {
        allow 127.0.0.1;
        deny all;
      }

      # include global/restrictions.conf;

      location ~* \.php$ {
        try_files $uri =404; # This is not needed if you have cgi.fix_pathinfo = 0 in php.ini (you should!)
        fastcgi_pass 127.0.0.1:9000;
      }

      # Only include one of the files below.
      include global/wordpress.conf;
      # include global/wordpress-ms-subdir.conf;
      # include global/wordpress-ms-subdomain.conf;
    }
}

每次改变后我都在跑:

sudo service nginx restart

我是否必须重启服务器? 上面的语法有问题吗?

对于上面的任何导入,内容几乎与关于为WordPress设置NGINX的WordPress文章相同。

对此有任何帮助将不胜感激。

0 个答案:

没有答案