If the writ is directed to the sheriff or other ministerial officer of the court out of which it issues, it must be delivered by the clerk to such officer without delay, as other writs are delivered for service. If it is directed to any other person, it must be delivered to the sheriff or a marshal, and be by him served upon such person by delivering the copy to him without delay, and make his return on the original to the court of issuance. If the person to whom the writ is directed cannot be found, or refuses admittance to the officer or person serving or delivering such writ, it may be served or delivered by leaving it at the residence of the person to whom it is directed, or by affixing it to some conspicuous place on the outside either of his dwelling house or of the place where the party is confined or under restraint.
Ca. Pen. Code § 1478