Nginx 无效的 URL 前缀 [英] Nginx invalid URL prefix
本文介绍了Nginx 无效的 URL 前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常基本的 nginx 设置,但由于某种原因失败了;
服务器{听80;server_name librestock.com;location =/favicon.ico { access_log off;log_not_found 关闭;}位置/静态/{根/home/david/StockSearch/stocksearch;}地点/{包括 proxy_params;proxy_pass unix:/home/david/StockSearch/stocksearch/stocksearch.sock;}}
根据我阅读的所有内容,我正确设置了服务器名称.当我用它工作的服务器的 ip 替换 librestock.com 时.
错误:
$ nginx -tnginx: [emerg]/etc/nginx/sites-enabled/stocksearch:12 中的无效 URL 前缀nginx: 配置文件/etc/nginx/nginx.conf 测试失败
解决方案
你的 unix: 路径需要 http://前缀,如:
proxy_pass http://unix:/home/david/StockSearch/stocksearch/stocksearch.sock;
见
http://nginx.org/en/docs/http/ngx_http_proxy_module.html>
I have a really basic nginx setup which is failing for some reason;
server {
listen 80;
server_name librestock.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/david/StockSearch/stocksearch;
}
location / {
include proxy_params;
proxy_pass unix:/home/david/StockSearch/stocksearch/stocksearch.sock;
}
}
according to everything I've read I'm setting the server name correctly. when I replace librestock.com with the ip of the server it works.
error:
$ nginx -t
nginx: [emerg] invalid URL prefix in /etc/nginx/sites-enabled/stocksearch:12
nginx: configuration file /etc/nginx/nginx.conf test failed
解决方案
You need the http:// prefix on your unix: path, as in:
proxy_pass http://unix:/home/david/StockSearch/stocksearch/stocksearch.sock;
See
http://nginx.org/en/docs/http/ngx_http_proxy_module.html
这篇关于Nginx 无效的 URL 前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文