在配置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. BZOJ 1109: [POI2007]堆积木Klo

    1109: [POI2007]堆积木Klo Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 948  Solved: 341[Submit][Statu ...

  2. Hadoop启动报Error: JAVA_HOME is not set and could not be found解决办法

    Hadoop安装完后,启动时报Error: JAVA_HOME is not set and could not be found. 解决办法: 修改/etc/hadoop/hadoop-env.sh ...

  3. linux永久更改eth0的ip地址

    linux中永久修改ip和子网掩码,可以用命令也可以直接到文件里修改.这里推荐直接到文件中修改.1.进入网卡配置文件 vi /etc/sysconfig/network-scripts/ifcfg-e ...

  4. 【poj3342】 Party at Hali-Bula

    http://poj.org/problem?id=3342 (题目链接) 题意 给出一棵树,要求在不存在两个节点相邻的条件下,选出尽可能多的节点,并且判断是否有多种选法. Solution 很水的树 ...

  5. SQL Server表结构和数据导入到MySQL

    借助的工具:Navicat for MySQL,链接:http://pan.baidu.com/s/1kVCw8IF 密码:g927 可以很明确的肯定,主键和自增列是没办法导入的,只能是表结构和数据. ...

  6. CruiseControl.NET/CCNET安装包下载

    链接:http://pan.baidu.com/s/1bHgeCI 密码:d7q1

  7. centos安装altas

    centos6.6 atlas2.2.1 atlas项目 https://github.com/Qihoo360/Atlas/releases yum -y install gcc make ncur ...

  8. [Java 实现AES加密解密]

    今天同学请教我这个问题,被坑了次…… 实现的功能是2个Java类:一个读取源文件生成加密文件,另一个类读取加密文件来解密. 整个过程其实很简单,java有AES的工具包,设好秘钥,设好输入内容,就得到 ...

  9. JAVA线程池的分析和使用

    1. 引言 合理利用线程池能够带来三个好处.第一:降低资源消耗.通过重复利用已创建的线程降低线程创建和销毁造成的消耗.第二:提高响应速度.当任务到达时,任务可以不需要等到线程创建就能立即执行.第三:提 ...

  10. How to set up an FTP server on Ubuntu 14.04

    How to set up an FTP server on Ubuntu 14.04 Setting up a fully-functional and highly secure FTP serv ...