这是nginx配置页面。我必须更改一些代码才能在维护html页面上获取图像。
server {
listen 80;
server_name 10.10.10.72;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/fa/timesheet;
}
location / {
if ($remote_addr != 10.10.10.120) {
return 503;
}
include proxy_params;
proxy_pass http://unix:/home/fa/timesheet/timesheet.sock;
}
#Error pages.
error_page 503 /maintenance.html;
location = /maintenance.html {
root /home/fa/timesheet ;
}
}
我的维护HTML页面是:
<html>
<body>
<h1 style="text-align:center;">
<h1 style="color:#33B2FF;">Timesheet has gone for time travel..... will be back with more users :)</h1>
<h1 style="color:#83A1B4;">Please visit later.</h1>
</body>
</html>
我必须在上面插入图片。请帮忙。
提前致谢
答案 0 :(得分:0)
将所有自定义html和图片放在维护
目录中 <强> /home/fa
强>
maintenance/maintenance.html
maintenance/maintenance.png
将图片标记放入 maintenance.html
<html>
<body>
<h1 style="text-align:center;">
<h1 style="color:#33B2FF;">Timesheet has gone for time travel..... will be back with more users :)</h1>
<h1 style="color:#83A1B4;">Please visit later.</h1>
<img src="maintenance.png" alt="maintenance" height="200" width="200">
</body>
</html>
并在 nginx.conf :
中更改此行error_page 500 502 503 504 /maintenance.html;
location = /maintenance.html {
root /home/fa/maintenance_pages;
}
location = /image.png {
root home/fa/maintenance_pages;
}
如果您在渲染图像类型时遇到问题,请阅读此链接:https://stackoverflow.com/a/19111990/6107715