A numerical simulation is carried out for static vortices in a long Josephson junction with an exponentially varying width. At specified values of the parameters the corresponding boundary-value problem admits more than one solution. Each solution (distribution of the magnetic flux in the junction) is associated to a Sturm--Liouville problem, the smallest eigenvalue of which can be used, in a first approximation, to assess the stability of the vortex against relatively small spatiotemporal perturbations. The change in width of the junction leads to a renormalization of the magnetic flux in comparison with the case of a linear one-dimensional model. The influence of the model parameters on the stability of the states of the magnetic flux is investigated in detail, particularly that of the shape parameter. The critical curve of the junction is constructed from pieces of the critical curves for the different magnetic flux distributions having the highest critical currents for the given magnetic field.