2016-12-12 6 views
1

これはnginxの設定ページです。メンテナンス用のHTMLページで画像を取得するために変更する必要があるコードです。Nginxサーバーを使用してメンテナンスページに画像を挿入する方法


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> 

私はそれの上に画像を挿入する必要があります。助けてください。ディレクトリ内のすべてのあなたのすべてのカスタムHTMLや画像を入れて、事前

答えて

0

おかげで、あなたのmaintenance.htmlでメンテナンス

/home/fa

maintenance/maintenance.html 
maintenance/maintenance.png 

入れイメージタグ

<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

関連する問題