Skip to main content

Nginx + Varnish + Apache Setup Fails!

Comments

5 comments

  • cPanelMichael
    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.
    0
  • dimtsef
    any luck fixing this ?? i have the same issue with default page showing !
    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
    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
    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.

    0
  • cPRex Jurassic Moderator
    @dimtsef - since the earlier portions of this thread are nearly 4 years old, the configurations would be completely different now as our Nginx implementation has changed several times. It would be best to open a new thread about the specific problems you're experiencing so we can check that.
    0
  • dimtsef
    well i found out the issue so i want to share it ! it was the default.vcl configuration error, on the backend configuration instead of 127.0.0.1 we have to replace it with the external ip of the server. restart the services and fixed !
    0
  • cPRex Jurassic Moderator
    I'm glad you were able to get things working!
    0

Please sign in to leave a comment.