% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={implementing-varnish-cache},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{implementing-varnish-cache}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{implementing-varnish-cache}{%
\section{implementing-varnish-cache}\label{implementing-varnish-cache}}

\hypertarget{implementing-varnish-cache-1}{%
\section{Implementing Varnish
Cache}\label{implementing-varnish-cache-1}}

.. contents::

\hypertarget{install-varnish}{%
\subsection{Install varnish}\label{install-varnish}}

.. code-block:: bash

sudo apt-get install varnish

\hypertarget{make-varnish-listen-to-port-80}{%
\subsection{Make varnish listen to port
80}\label{make-varnish-listen-to-port-80}}

Also disable the varnish admin port

.. code-block:: bash

sudo cp -p /etc/default/varnish /etc/default/varnish.ORIG sudo vim
/etc/default/varnish

diff /etc/default/varnish /etc/default/varnish.ORIG 40c40,41 \textless{}
DAEMON\_OPTS=``-a :80\\
--- \textgreater{} DAEMON\_OPTS=''-a :6081\\
\textgreater{} -T localhost:6082\\

\hypertarget{make-apache2-vhosts-listen-to-port-8080}{%
\subsection{Make Apache2 vhosts listen to port
8080}\label{make-apache2-vhosts-listen-to-port-8080}}

.. code-block:: bash

cp -p /etc/apache2/ports.conf /etc/apache2/ports.conf.ORIG sudo vim
/etc/apache2/ports.conf diff /etc/apache2/ports.conf
/etc/apache2/ports.conf.ORIG 8c8 \textless{} NameVirtualHost \emph{:8080
--- \textgreater{} NameVirtualHost }:80 10c10 \textless{} Listen 8080
--- \textgreater{} Listen 80

Now edit all the vhost files with two commands:

.. code-block:: bash

cd /etc/apache2/sites-available sudo perl -pi -w -e `s/:80/:8080/g;' *

The above command performs a search and replace on every file in the
directory changing :80 to :8080

\hypertarget{restart-daemons}{%
\subsection{Restart Daemons}\label{restart-daemons}}

.. code-block:: bash

sudo service apache2 restart sudo service varnish restart

\end{document}
