Discover Centmin Mod today
Register Now

Sysadmin Dynamic http image on https server

Discussion in 'System Administration' started by Sunka, Nov 28, 2016.

  1. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    I have several images links on xenforo pages that are dynamic. Every 24 hours images change on home server, but name stay same.

    Because that home server is only http, my xenforo page get "mixed content" (http and https).
    Is there any chance and guide how to get trough proxy that images, or any other modus so images will be https "on my page template"?

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Why not setup home server with https based images ?
     
  3. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    One server is enough for me to manege it :ROFLMAO:
    It is not problem for any other image, because I can host it on my server ot anywhere else where is https server, but this few images I can not, because they are updated every 24 hours on another page.
    It is forecast and tide images from another webpage - look here for example
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    setup a cronjob on forum server to wget or pull images from remote to local directory i.e. /home/nginx/domains/domain.com/public_html/remote_images so they're served from domain.com/remote_images
     
  5. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    Something like that:
    Code:
    wget -O /my/path/to/remote_images/image.png http://url/to/image.png
    If cron run today, and image is saved, than next day cron run again and wget is saving image with same name, will it be a problem because there is already an image with same name?
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    try
    Code (Text):
    rm -rf /my/path/to/remote_images/image.png; wget -O /my/path/to/remote_images/image.png http://url/to/image.png
    
     
  7. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    I have problem with some images.
    Curl and wget are timed out.
    I can see/download image in browser, but I can not pull/download it from terminal.
    Maybe port 9001 is source of problem?

    This is link to image:
    Code:
    http://161.53.31.3:9001/graphs/1.png
    Any thougts?
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    can you change that 9001 port ?

    that can be potentially be used by php-fpm so ideally you don't want to whitelist 9001 port inbound but you can whitelist and add 9001 port to /etc/csf/csf.conf TCP_IN and TCP6_IN comma separated list to whitelist in CSF Firewall CSF Firewall - CentminMod.com LEMP Nginx web stack for CentOS and restart CSF Firewall
    Code (Text):
    csf -r
    

    or just whitelist the source ip for 9001 port inbound as per CSF Firewall - CentminMod.com LEMP Nginx web stack for CentOS

    append to /etc/csf/csf.allow where 11.22.33.44 is the source ip server address
    Code:
    tcp|in|d=9001|s=11.22.33.44
    and restart CSF Firewall
    Code (Text):
    csf -r
    
     
  9. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    Added tcp|in|d=9001|s=161.53.31.3 in /etc/csf/csf.allow
    csf restarted

    But still no luck :(

    Code:
    [root@upcloud ~]# wget -O /home/nginx/domains/pijanitvor.com/public/moje_graphic/razno_https/jadran_wget/8.png http://jadran.izor.hr:9001/graphs/8.png
    --2016-11-29 15:06:48--  http://jadran.izor.hr:9001/graphs/8.png
    Resolving jadran.izor.hr (jadran.izor.hr)... 161.53.31.3
    Connecting to jadran.izor.hr (jadran.izor.hr)|161.53.31.3|:9001... failed: Connection timed out.
    Retrying.
    
    --2016-11-29 15:07:04--  (try: 2)  http://jadran.izor.hr:9001/graphs/8.png
    Connecting to jadran.izor.hr (jadran.izor.hr)|161.53.31.3|:9001... failed: Connection timed out.
    Retrying.
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh i mistakenly thought the download was on local centmin mod server but if it's remote, you don't whitelist 9001 port at all

    looks like http://jadran.izor.hr:9001/graphs/8.png is blocking such downloads ?

    Code (Text):
    curl -Iv http://jadran.izor.hr:9001/graphs/8.png
    * About to connect() to jadran.izor.hr port 9001 (#0)
    *   Trying 161.53.31.3...
    * Connection timed out
    * Failed connect to jadran.izor.hr:9001; Connection timed out
    * Closing connection 0
    curl: (7) Failed connect to jadran.izor.hr:9001; Connection timed out


    libcurl - Error Codes
     
  11. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:58 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    So no solution for "in terminal" image download?
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,857
    12,238
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,809
    Local Time:
    5:58 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    not if they're blocking somehow