DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize Directadmin and support it.

DirectAdmin Knowledge Base

NGINX + Varnish + Apache on Directadmin powered server

| 12:09:49 25.09.2014

Since custombuild 2 gives us opportunity to have a reverse-proxy NGINX Apache on a server and that's quite easy to start using it, we need a small customization to get content cached with Varnish (do you really need it?).

Install NGINX+Apache with Custombuild 2

Instructions can be found here: Reverse-proxy NGINX + Apache on Directadmin powered server

Install Varnish

Install Varnish by your favourite guide (or any from the official site):

As for now varnish does not support SSL, so it will cache only requests to plain HTTP.

Modify NGINX templates

Copy

/usr/local/directadmin/data/templates/nginx_server.conf 
/usr/local/directadmin/data/templates/nginx_server_sub.conf

to

/usr/local/directadmin/data/templates/custom/nginx_server.conf 
/usr/local/directadmin/data/templates/custom/nginx_server_sub.conf

Modify the files

/usr/local/directadmin/data/templates/custom/nginx_server.conf 
/usr/local/directadmin/data/templates/custom/nginx_server_sub.conf

change line:

proxy_pass http://|IP|:|PORT_8080|;

to

proxy_pass http://|IP|:6081;

Change 6081 to any other value of TCP post where Varnish is accepting connections.

Rewrite nginx virtual hosts:

echo "action=rewrite&value=nginx" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq

Have a good day!

Update!

We have many reports and emails that the guide is not working (they think so)! Be sure, it's still working. The root cause of a confuse is that the guide does not cover how to install and configure Varnish. You still need to update settings in /etc/varnish/default.vcl. And at least the backend port should be changed to 8080.

1
About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable expirience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.




All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition