Does the category of locally ringed spaces have products? The category of schemes has all fibered products, but the proof uses affine schemes in a crucial way. I want to understand whether this is true for the category of locally ringed spaces. The standard sources for categorical properties (nLab and Stacks project) do not say or contradict this fact explicitly. Though they say that the fiber product of schemes is automatically fiber product in the category of locally ringed spaces (remark 16.2 in the Schemes chapter of Stacks project).
The simplest locally ringed space which is not a scheme is a single point with a local ring (which is not a field) as a structure sheaf. The tensor product of local rings need not be a local ring, but it seems possible that this tensor product is always the direct product of local rings. For fields this is true, and I was unable to verify it for the general case. Even if this holds (which I highly doubt), it's still possible that more complicated fibered product do not exist. Maybe there is an obvious counterexample which I missed?
 A: I don't know whether the following is available in published form somewhere, I learned it from Jens Franke. I have written notes in german, and Martin has them in english, I think?
Suppose $f: X\to Z$ and $g: Y\to Z$ are morphisms of locally ringed spaces. The fiber product $X\times_Z Y$ of $f$ and $g$ in the category $\textbf{LRS}$ can be described as follows:


*

*Underlying set: The set underlying of $X\times_Z Y$ is given by
$$X\times_Z Y := \{(x,y,{\mathfrak p})\ |\ x\in X, y\in Y, f(x)=g(y)=:z,\\\quad\quad\quad\quad\quad\quad{\mathfrak p}\in\text{Spec}({\mathcal O}_{X,x}\otimes_{\mathcal O_{Z,z}}{\mathcal O}_{Y,y}),\\ \quad\quad\quad\quad\quad\quad\quad\quad\ \iota_{x,y,X}^{-1}({\mathfrak p})={\mathfrak m}_{X,x}, \iota^{-1}_{x,y,Y}({\mathfrak p}) = {\mathfrak m}_{Y,y}\}$$
Here, $\iota_{x,y,X}: {\mathcal O}_{X,x}\to{\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y}$ and $\iota_{x,y,Y}: {\mathcal O}_{Y,y}\to{\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y}$ are the canonical maps. 

*Topology: For $U\subset X$ and $V\subset Y$ open and $f\in{\mathcal O}_X(U)\otimes_{{\mathcal O}_Z(Z)}{\mathcal O}_Y(V)$ put
$${\mathcal U}(U,V,f)\ :=\ \{(x,y,{\mathfrak p})\in X\times_Z Y\ |\ x\in U, y\in V, (\text{im. of } f\text{ in } {\mathcal O}_{X,x}\otimes_{\mathcal O_{Z,z}}{\mathcal O}_{Y,y})\notin {\mathfrak p}\}.$$
This defines the base for a topology on $X\times_Z Y$.

*Structure sheaf: For $(x,y,{\mathfrak p})$ denote ${\mathcal O}_{X\times_ ZY,(x,y,{\mathfrak p})} := ({\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y})_{\mathfrak p}$. For $W\subset X\times_Z Y$ put
$${\mathcal O}_{X\times_Z Y}(W) := \{(\lambda_{x,y,{\mathfrak p}})\in\prod\limits_{(x,y,{\mathfrak p})\in W} {\mathcal O}_{X\times_Z Y,(x,y,{\mathfrak p})}\ |\ \text{for every } (x,y,{\mathfrak p})\in W\text{ there ex. } \\ \text{std. open }{\mathcal U}(U,V,f)\subset W\text{ cont. } (x,y,{\mathfrak p})\text{ and }\mu\in({\mathcal O}_X(U)\otimes_{{\mathcal O}_Z(Z)}{\mathcal O}_{Y}(V))_f\\ \text{s.t. for all }(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})\in{\mathcal U}(U,V,f)\text{ we have } \lambda_{(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})}=\mu_{(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})}\}$$
(The stalk of ${\mathcal O}_{X\times_Z Y}$ at $(x,y,{\mathfrak p})$ it then indeed $({\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y})_{\mathfrak p})$

*Structure morphisms: One has canonical projections $X\leftarrow X\times_Z Y\to Y$, details ommitted for now.
There are many things to be checked, but maybe you want to think about them yourself to familiarize with the definitions?
