Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7190817
  • 博文数量: 510
  • 博客积分: 12019
  • 博客等级: 上将
  • 技术积分: 6836
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-01 16:46
文章分类

全部博文(510)

文章存档

2022年(2)

2021年(6)

2020年(59)

2019年(4)

2018年(10)

2017年(5)

2016年(2)

2015年(4)

2014年(4)

2013年(16)

2012年(47)

2011年(65)

2010年(46)

2009年(34)

2008年(52)

2007年(52)

2006年(80)

2005年(22)

分类: LINUX

2020-12-10 09:55:05

配置多个站点404
我选择了配置多个location。

location / {
         root   /data/html/;
         index  index.html index.html;
    }
    location /publicity {
         root /usr/local/nginx/hzcloud-timp-front/;
         index  index.html index.htm;
    }

配置完以后访问。 提示404
找了好久才搞明白, location如果一个特定的url 要使用别名,不能用root,alias指定的目录是准确的,root是指定目录的上级目录,改动后即可以使用了

location /publicity {
         alias /usr/local/nginx/hzcloud-timp-front/;
         index  index.html index.htm;
    }
 
又比如
 location ^~/doc/ {
        index  index.html index.htm;
        alias  /usr/share/nginx/html/apidoc/;
        #或者用下面
 # root  /usr/share/nginx/html;  

 }

阅读(2428) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~