ngnix开启伪静态报错
kouge 2022-1-26

我在使用本论坛的伪静态开启指令的时候出现了以下报错:nginx: [emerg] "location" directive is not allowed here in /www/server/nginx/conf/nginx.conf:59 nginx   {如图位置保存时即出现上文中出现的报错,使用代码如下}

location / { 

    rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;

    index    index.html index.htm index.php;

     root     /data/wwwroot/xiuno.com;

}

请问各位大佬如何解决

最新回复 (4)
全部楼主
  • xdy0322
    2022-1-26 2
    0
    location ~* \.(htm)$ 
           {

                    rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;

           }

    这段放在server块里面
  • kouge 楼主
    2022-1-26 3
    0
    好的谢谢,我试过了可以的
  • ABC23
    2022-4-3 4
    0
    楼主,你写得实在是太好了。我惟一能做的,就只有把这个帖子顶上去这件事了。 
  • 430135421
    2022-9-13 5
    0
    楼主,我只是来混个熟的!老板,侬亿雷凑闹嫩了!
返回