$\DeclareMathOperator\Tr{Tr}$
From what I've read from your original post, it seems that you're trying to calculate the Casimir force from the vacuum energy. Recall the relationship between the path integral and vacuum energy $$\int e^{-S[\phi]}{\cal D}\phi = e^{-\beta E_0}$$ in the limit $\beta\rightarrow\infty$, where I've gone to Euclidean space. For a free scalar theory in (1 + 1) dimensions, for the Casimir effect, we've got to impose Dirichlet boundary conditions on the spatial dimension. Explicitly, we've got to do the integral $$\int\exp{\bigg(-\frac{1}{2}\int\phi(x)(-\partial^2 + m^2)\phi(x)d^2x\bigg)}{\cal D}\phi$$ This is an easy Gaussian integral, given by $$\frac{1}{\sqrt{\det(-\partial^2 +m^2)}} = e^{-\frac{1}{2}\Tr\log(-\partial^2 +m^2)}$$ To calculate $\Tr\log(-\partial^2 + m^2)$, it's easiest to sum over momentum states (Remember we get a factor of $\beta$ to ensure we're counting states with the correct weight) $$\beta\sum_{n=1}^{\infty}\int\log\bigg((p^0)^2+\Big(\frac{\pi n}{L}\Big)^2+m^2\bigg)\frac{dp^0}{2\pi}$$ Breaking up the log and sending the sum in as a product, we get $$\beta\int\log\bigg(\prod_{n=1}^{\infty}\Big(\frac{\pi n}{L}\Big)^2\bigg)\frac{dp^0}{2\pi}+\beta\int\log\bigg(\prod_{n=1}^{\infty}\bigg(1+\bigg(\frac{L\sqrt{(p^0)^2+m^2}}{\pi n}\bigg)^2\bigg)\bigg)\frac{dp^0}{2\pi}$$ The last term is a convergent product (hyperbolic sine), we only need to regulate the second term. The best method for this is Zeta function regularization, which I'll briefly outline. If we have a product of the form $\prod_{n}a_{n}$, we can form the associated Zeta function $\zeta_{A}(s)=\sum_{n}a_{n}^{-s}$. Just take the derivative and do a line of algebra to show that $\prod_{n}a_{n} = e^{-\zeta_{A}'(0)}$. The basic idea of the regulator is that while the product may diverge, the Zeta function may have an analytic continuation to $s=0$ which gives a finite value. For $a_{n}=(\pi n/L)^2$, we get $$\zeta_{A}(s)= \bigg(\frac{L}{\pi}\bigg)^{2s}\zeta(2s)$$ where a Zeta with no subscript is just the Riemann Zeta function. Taking the derivative and exponentiating, the regulator gives us $\prod_{n=1}^{\infty}a_{n}=2L$. Putting it all together, we get $$\Tr\log(-\partial^2+m^2)=\beta\int\log\bigg(2\sinh\bigg(L\sqrt{(p^0)^2+m^2}\bigg)\frac{dp^0}{2\pi}$$ plus some $L$ independent constant that we don't care about. You should be able to calculate the ground state energy, and then the Casimir force by differentiating, from comparison with the path integral. Hope this helped!
Edit: My original argument was a bit sloppy, so I cleaned it up. Also, you will have to do a trick where you introduce a 3rd plate to prevent the infinite ground state contributions from the field oscillators from rendering the force infinite. For details, see Zee's QFT in a Nutshell, Section 1.9.