Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Nginx + Varnish + Apache Setup Fails!

Discussion in 'Workarounds and Optimization' started by Xhuljo Skendaj, Nov 28, 2017.

  1. Xhuljo Skendaj

    Joined:
    Oct 27, 2017
    Messages:
    9
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Albania
    cPanel Access Level:
    Root Administrator
    Hello

    I have some days trying to setup Nginx => Varnish = > Apache.

    Nginx As main web server because we need SSL support, Varnish for Cache and Apache as it is by default just port will change..

    So the idea is just to speed up websites who are hosted by us also security. I'm not saying that Apache has no security but i like Nginx and in this way it will be more easy for me to manage then i can manage Apache.

    And so i started to work with it. Firstly i have install Nginx (nginx/1.13.4 (nginx-plus-r13)) + varnish (v5.2) and the setup as of now is

    Nginx => PORT : 80
    Varnish => PORT : 8080
    Apache => PORT : 8787

    The setup of Nginx As a reverse proxy has the same config files of Engintron Plugin (just proxy rules, cache settings has been removed), The varnish has no configuration file because i'm trying to make it to work then optimize it.
    First problem was that varnish was sending SERVER IP to apache and not X-Forwarded-For header, then i added
    Code:
      unset req.http.X-Forwarded-For;
      set req.http.X-Forwarded-For = req.http.X-Real-IP;
    
    Now i'm getting the real client ip in apache logs (at WHM). but still my problem is here i cannot see website content but cPanel default page (scr attached)

    All the time i have use just Nginx this is my first time trying and working with Varnish and maybe i'm doing something wrong or should i add something else to varnish configuration ?
    i tried to add
    Code:
    set req.http.X-Forwarded-Host = req.http.X-Forwarded-Host;
    
    But no result...
    i also tried to set to varnish config file other headers (X-Forwarded-Port, X-Forwarded-Server, X-Forwarded-Proto) but no result again..
    I have try to see around logs and other stuff for nginx varnish and apache but no luck still i cannot find what's wrong..

    Can someone help about this please?!

    Currently i have this setup done! But is not like this Everything in one server, it's
    Server1 : cPanel Apache Running on port : 80
    Server2 : Varnish running on port 80
    Server3 : Nginx running on port 80

    Traffic goes Nginx => Varnish => cPanel
    And it works! But i don't know why it doesn't work when i setup everything into cPanel server!
    May you will say when it's already done why you need this? Well in the way which i have i will need to setup each new domain configurations up manually.. my current cPanel server can handle them so as of now there is no reason using 2 additional servers when everything can be used in one!

    Thanks.
     

    Attached Files:

    #1 Xhuljo Skendaj, Nov 28, 2017
    Last edited: Nov 28, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,484
    Likes Received:
    1,612
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I've moved this to our Workarounds forum so you may receive user-feedback to your topic. Note that this type of setup is unsupported, so you may want to consult with a system administrator for additional assistance. We provide a list of system admin services at:

    System Administration Services | cPanel Forums

    Thank you.
     
    Xhuljo Skendaj likes this.
Loading...

Share This Page