码迷,mamicode.com
首页 > 其他好文 > 详细

配置 nginx server 出现nginx: [emerg] "root" directive is duplicate in /etc/nginx/server/blogs.conf:7

时间:2015-02-13 18:09:59      阅读:509      评论:0      收藏:0      [点我收藏+]

标签:

在配置nginx 虚拟机时,执行

sudo /usr/sbin/nginx -t

报下面的错误:

nginx: [emerg] "root" directive is duplicate in /etc/nginx/server/blogs.conf:7
nginx: configuration file /etc/nginx/nginx.conf test failed

 

错误原因是:在配置文件时,访问路径设置了两个,重复配置webroot路径导致,去掉一个就可以了。

 

server {
        listen 80 default_server;

        #root /usr/share/nginx/html/;去掉这行
        index index.html index.htm;
        # Make site accessible from http://localhost/
        root /home/wangkongming/webroot/blogs;

        index index.html index.htm;
        server_name blogs.local;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
        access_log /data/logs/blogs/access.log;
        error_log /data/logs/blogs/error.log;

}

 

配置 nginx server 出现nginx: [emerg] "root" directive is duplicate in /etc/nginx/server/blogs.conf:7

标签:

原文地址:http://www.cnblogs.com/wangkongming/p/4290520.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!