As in the title:
There is only oneserver in
nginx. All domain names are configured the same. Through the program, each domain name is an independent site. If you want each domain name to display its own 404 page when 404 occurs, , I don’t know how to configure and implement it under nginx
server {
...
server_name a.com b.cn d.org ....; # 配置了很多域名
...
error_page 404 /404.html;
}
Just move the following to the http scope. Don’t write one in each server
error_page 404 /404.html;
If you encounter this kind of problem, you should read the documentation:
Syntax: error_page code ... [=[response]] uri;
Default: —
Context: http, server, location, if in location
context represents the scope of this error_page syntax, indicating that it can be placed in http.
Try map
//context http
//context server