nginx.conf配置失败nginx:[emerg]未知指令“user”在/usr/local/nginx/conf/nginx.conf:1

时间:2016-07-27 08:35:43

标签: php nginx

我在LNMP环境中的nginx版本1.8.0中出现此错误

nginx: [emerg] unknown directive "user" in /usr/local/nginx/conf/nginx.conf:1

如何配置? 我在谷歌搜索但仍然没有得到任何帮助

这是我的nginx.conf代码

user  www www;

worker_processes 1;

error_log  /home/wwwlogs/nginx_error.log  crit;

pid        /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }

http
    {
        include       mime.types;
        default_type  application/octet-stream;

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;

        fastcgi_split_path_info ^((?U).+\.php)(/.+)$;

        fastcgi_param   SCRIPT_FILENAME       $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO       $fastcgi_path_info;
        fastcgi_param   PATH_TRANSLATED     $document_root$fastcgi_path_info;

        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;

        #fastcgi_param  SCRIPT_FILENAME     $request_filename;
        fastcgi_param   SCRIPT_NAME     $fastcgi_script_name;
        fastcgi_param   REQUEST_URI     $request_uri;
        fastcgi_param   DOCUMENT_URI        $document_uri;
        fastcgi_param   DOCUMENT_ROOT       $document_root;
        fastcgi_param   SERVER_PROTOCOL     $server_protocol;

        fastcgi_param   GATEWAY_INTERFACE   CGI/1.1;
        fastcgi_param   SERVER_SOFTWARE     nginx/$nginx_version;

        fastcgi_param   REMOTE_ADDR     $remote_addr;
        fastcgi_param   REMOTE_PORT     $remote_port;
        fastcgi_param   SERVER_ADDR     $server_addr;
        fastcgi_param   SERVER_PORT     $server_port;
        fastcgi_param   SERVER_NAME     $server_name;

        # PHP only, required if PHP was built with --enable-force-cgi-redirect
        fastcgi_param   REDIRECT_STATUS     200;



        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;

        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";

        #limit_conn_zone $binary_remote_addr zone=perip:10m;
        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

        server_tokens off;
        #log format
        log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
        access_log off;
        server {
            listen       80;
            server_name  115.28.30.35;
            location / {
                root   /home/wwwroot/default;
                index  index.html index.htm;
            }
        }
        server {  
               listen  80;    
               server_name www.finderway.cn;

               #root
               set $root_path '/home/wwwroot/www.finderway.cn/finderway/public';    
               root $root_path;    
               index index.html index.htm index.php;    

                location / {
                    try_files $uri $uri/ /index.html;
                }

                location /index.html { 
                    rewrite ^ /index.html break; 
                } 


                #php
                location ~ \.php {
                    fastcgi_pass www.finderway.cn:9000;
                    fastcgi_index index.php;
                    include fastcgi_params;
                }

          }  
    include /usr/local/nginx/conf/vhost/*;
}

nginx -t

nginx:[emerg] /usr/local/nginx/conf/nginx.conf中的未知指令“user”1

nginx:配置文件/usr/local/nginx/conf/nginx.conf测试失败

0 个答案:

没有答案