If you can make the cabinet so that the front door is acoustically transparent material, and use a front firing, front ported sub, then yes it would probably work. You will still most likely get some boundary effect from the sub being close to a wall.
Tritonman has a VERY good point too - limiting yourself to basically one spot may not yeild the best results for a given sub in your particular room. CAN you do it? Yes. Should you do it is probably a better question...