在配置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. [bzoj1787][Ahoi2008]紧急集合

    Description 给定一棵大小为的树,有组询问,每组询问给三个点,求到这三个点距离和最小的点及最小距离和. Input 第一行两个数. 接下来行,每行两个数表示到有一条边. 最后行,每行个数,为 ...

  2. BZOJ2120 数颜色(带修改莫队)

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转 ...

  3. malware analysis、Sandbox Principles、Design && Implementation

    catalog . 引言 . sandbox introduction . Sandboxie . seccomp(short for secure computing mode): API级沙箱 . ...

  4. Solution: Win 10 和 Ubuntu 16.04 LTS双系统, Win 10 不能从grub启动

    今年2月份在一台装了Windows的机器上装了Unbuntu 14.04 LTS (双系统, dual-boot, 现已升级到 16.04 LTS). 然而开机时要从grub启动 Windows (选 ...

  5. plist文件的使用

    什么是plist文件 直接将数据写在代码里面,不是一种合理的做法.如果经常改,就要经常翻开对应的代码进行修改,造成代码扩展性低 因此,可以考虑将经常变的数据放在文件中进行存储,程序启动后从文件中读取最 ...

  6. iOS 获得当前经纬度和城市

    1.引入CoreLocation.framework,#import <CoreLocation/CoreLocation.h>,添加委托CLLocationManagerDelegate ...

  7. spring--aop总结

    AOP(Aspect Oriented Programming的缩写)所用的思想其实和设计模式是一样的,即在不修改原代码的情况下统一增加或者修改功能.还有,AOP大多用在spring里面. AOP是面 ...

  8. zabbix 安装

    php+nginx+mysql+zabbix 官方https://www.zabbix.com/documentation/3.0/manual/installation/install 1.安装依赖 ...

  9. oneM2M

    http://www.ccsa.org.cn/organization/intro.php?org=oneM2M 一.成立背景 随着物联网技术研发及市场推广的不断深入,全球各通信标准化组织都在加强物联 ...

  10. easyUI学习笔记之tab组件的鼠标事件

    一.鼠标经过组件后的事件,自动打开选项卡内容 var tabs = $('#tt').tabs().tabs('tabs'); for(var i=0; i<tabs.length; i++){ ...