nginx:未知指令“位置"; [英] nginx : unknown directive "location"
本文介绍了nginx:未知指令“位置";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码(从第35行开始):
Here is my code (starting with line 35):
location /
{
index index.php;
root /home/body;
if ($request_filename !~ (js|css|images|robots\.txt|index\.php.*) ) {
rewrite ^/(.*)$ /index.php/$1 last;
}
}
这是错误:
[emerg]: unknown directive "location" in /opt/nginx/conf/nginx.conf:35
任何人都可以帮助解决此问题吗?预先感谢.
Can anyone help how to fix this? Thanks in advance.
推荐答案
确保 location 指令位于服务器块内部:
Ensure that location directive located inside of server block:
http {
...
server {
...
location ...
}
}
这篇关于nginx:未知指令“位置";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文