是否可能在Nginx上使用一个“Bad Portal”的习惯错误网页?
类似习俗404页。
是否可能在Nginx上使用一个“Bad Portal”的习惯错误网页?
类似习俗404页。
它类似于设立404页的习俗。 这里我所说的话。
#site-wide error pages
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
有三个部分必须到位,才能显示您的习俗错误,而不是通用的“Bad Portal”错误。
You must create an html file named something like "500.html" and place it in the root. In the case of Rails running behind Nginx, this means putting it at public/500.html.
你在座标书中必须有一个线,至少把502个错误点到500.html页上:
error_page 502 /500.html;
你在座标书中必须有一个500.html号位置。 如果你们的根基已经界定,那块土地是空的。 但是,必须存在障碍。
location /500.html{
}
采用 de(实际为9.3长)的方法,即:
/var/www.html/502.html>。 载有502个错误页的内容
edit /etc/nginx/sites-enabled/mywebsite.conf
因此,它认为:
server {
listen 80; listen [::]:80;
server_name www.mywebsite.com;
error_page 502 /502.html;
location /502.html {
root /var/www/html;
}
}
service nginx restart
虽然“拉森塔尔”的答案在技术上是正确的,但有一些共同配置,无法运作。 @Jack 沙漠答案涉及这一点,但并未充分解释为何需要。
我们有这种组合(从@Jack简单化)。
error_page 502 504 /my-error-page.html;
如果内部有502或504个错误,将原来的《国际仲裁裁决汇编》改成<代码>/my-error-page.html>。
我认为,大多数人的错觉是,如果你直接要求这一页,那么通过同一处理链条()来做到这一点。 这意味着它通过所有同一地点块检查。
由于对面值进行反向代理的共同方法是编造一个<条码>所在地>/{条码>栏,该位置与<条码>/米-ror-page.html条码>相匹配,因此nginx 试图利用代理人来为错误档案服务<>。 由于一个共同使用案件正在 serving倒的情况下静态存档,因此,从后台接来的这个错误页也可能失败,使原谅违约成为我们试图首先替换的内部错误页。
So, a common solution, the one @Jack Desert suggests, is to include another location
block that will match the /my-error-page.html
URL before the location /
block. Note that the order of location blocks in nginx configuration has no effect; There is a very specific set of rules for picking precedence of location blocks based on the URL. That location block needs to have whatever is necessary to serve that file like any other static file that nginx might serve. This means a root
directive is needed somewhere and that /my-error-page.html
will be loaded relative to that (root
can be set at nearly any level of the nginx configuration).
是的
类型
cd /etc/nginx
sudo nano nginx.conf
http://www.ohchr.org
error_page 500 Path_to_your_custom_error_page;
error_page 503 Path_to_your_custom_error_page;
error_page 504 Path_to_your_custom_error_page;
现在重新开始,打上这一指挥:
sudo service nginx restart
贝戈现在,你可以看到门道错误的习俗错误信息。
问题不言而喻,但当APICS背后通过代理人的原产地转子时,这个问题就很常见,因此,你想要回答的是JSON而不是超文本。
我赞成的做法是,仅使用<代码>error_page指令的中转功能,以便重新回到同一地点的一个错误网页:
error_page 502 503 $scheme://$server_name/500.json;
从一行,你可以重新使用不同的<代码>500.json,<<>>>>,不需要一个神秘的空洞<代码><<>>>>>。 请将你的错误信息放在<代码>500.json文档中,放在你的网站上。 我假定,你已经有了一份<代码> 所在地/{......}指令,该指令提供了固定档案。
当然,你也可以采用同样的方法,也使用超文本误差页。
I have used docker image nginx:1.18.0-alpine previously and below is the conf. It works as expected app.localhost --> points to the block wit server_name app.* localhost --> points to the other ...
I m having a problem getting more memory out of PHP. This is the error message: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ... Yet: I ve set ...
Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he ...
what I m looking for is the ability for nginx to detect that a url has the query string variable cid. for example www.adomain.com/froggy?cid=12&as=false (query string can be solo or mixed with ...
I upload images to my App using Ajax and an Iframe. In Development everything works like a charm. But in production Nginx suddenly raises a 404 error. When I look into the log, the request never hits ...
I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection ...
We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...
Essentially, my route is working perfectly, Passenger seems to be loading - all is hunky-dory. Except that nothing Railsy happens. Here s my Nginx log from starting the server to the first request (...