在配置nginx 虚拟机时,执行

sudo /usr/sbin/nginx -t

报下面的错误:

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

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

server {
listen 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/ =;
} location ~ \.php$ {
fastcgi_pass 127.0.0.1:;
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的更多相关文章

  1. nginx: [emerg] "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default:57

    /************************************************************************************************ * ...

  2. nginx: [emerg] unknown directive "stub_status" in /home/oscf/nginx/conf/conf.d/ngx_metric.conf

    解压安装过程命令如下: cd /home/oscf #该目录下有nginx压缩包 mkdir nginx tar -zxvf nginx-1.16.0.tar.gz cd nginx-1.16.0 . ...

  3. nginx重写rewrite的[emerg] unknown directive

    今天写nginx的重写规则.怎么写总是报这个错误.

  4. nginx:[emerg]unknown directive "ssl"

    nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:102 到解压的nginx目录 ...

  5. 启动 nginx 失败 "fastcgi_pass" directive is duplicate

    [emerg] 4953#0: "fastcgi_pass" directive is duplicate in /etc/nginx/sites-enabled/default: ...

  6. Nginx配置SSL报错 nginx: [emerg] unknown directive "ssl"

    Nginx配置SSL报错 nginx: [emerg] unknown directive "ssl"     出现如图所示错误,处理办法如下 去nginx解压目录下执行 ./co ...

  7. 错误提示 nginx: [emerg] unknown directive "gzip_static"

    1.检查nginx配置文件错误提示如下: [root@server nginx]# /applications/nginx/sbin/nginx -t -c /applications/nginx/n ...

  8. nginx: [emerg] unknown directive "聽" in D:\software03\GitSpace\cms\nginx-1.14.0/conf/nginx.conf:36

    nginx: [emerg] unknown directive "聽" in D:\software03\GitSpace\cms\nginx-1.14.0/conf/nginx ...

  9. nginx: [emerg] unknown directive “ ” in /usr/local/nginx/nginx.conf.conf:xx报错处理

    当我们在修改Nginx的配置文件,然后加载配置文件./nginx -s reload   报错类似的错误, nginx: [emerg] unknown directive “ ” in /usr/l ...

随机推荐

  1. leetcode 402. Remove K Digits

    Given a non-negative integer num represented as a string, remove k digits from the number so that th ...

  2. 【bzoj1408】 Noi2002—Robot

    http://www.lydsy.com/JudgeOnline/problem.php?id=1408 (题目链接) 题意 定义了3种数,分别求这3种数的φ的和,其中φ(1)=0. Solution ...

  3. CF 213A Game(拓扑排序)

    传送门 Description Furik and Rubik love playing computer games. Furik has recently found a new game tha ...

  4. Java中如何遍历Map对象的4种方法

    在java中遍历Map有不少的方法.我们看一下最常用的方法及其优缺点. 既然java中的所有map都实现了Map接口,以下方法适用于任何map实现(HashMap, TreeMap, LinkedHa ...

  5. Nuxt.js logoVue.js 后端渲染开源库 Nuxt.js

    Nuxt.js 是一个通过 Vue 用于服务端渲染的简单框架,灵感来自 Next.js. 目前尚处于开发阶段,1.0 版本即将发布 1 分钟视频演示 Nuxt 基于 ES2015,这使得代码有着更愉快 ...

  6. Mysql学习笔记(五)数据查询之测试sql部分。

    正文之前,介绍mysql一些很有趣的命令. 快速的创建表,并填充表数据. create table test like  已经有的表名: inset into test select * from f ...

  7. 收集的一些jQuery (我平常用的少的,但确实挺有效果的)

    禁用Jquery(动画)效果 jQuery.fx.off = true; 使用自己的 Bullets(这个有一丁点儿的小技巧) //这里是js代码 也就是给每个ul添加一个类名 然后给ul的子li前面 ...

  8. 超强语感训练文章(Provided by Rocky teacher Prince)

    Content: Class1 My name is Prince Class2 Welcome to our hotel Class3 We’re not afraid of problems Cl ...

  9. 有return的情况下try catch finally的执行顺序

    结论:1.不管有木有出现异常,finally块中代码都会执行:2.当try和catch中有return时,finally仍然会执行:3.finally是在return后面的表达式运算后执行的(此时并没 ...

  10. nginx的在linux系统中的安装

    1 nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. n  gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果 ...