The rising concept of reconfigurable intelligent surface (RIS) has promising potential for Beyond 5G localization applications. We herein investigate different phase profile designs at a reflective RIS, which enable non-line-of-sight positioning in nearfield from downlink single antenna transmissions. We first derive the closed-form expressions of the corresponding Fisher information matrix (FIM) and position error bound (PEB). Accordingly, we then propose a new localization-optimal phase profile design, assuming prior knowledge of the user equipment location. Numerical simulations in a canonical scenario show that our proposal outperforms conventional RIS random and directional beam codebook designs in terms of PEB. We also illustrate the four beams allocated at the RIS (i.e., one directional beam, along with its derivatives with respect to space dimensions) and show how their relative weights according to the optimal solution can be practically implemented through time sharing (i.e., considering feasible beams sequentially).