Methods of tropical (idempotent) mathematics are applied to the solution of minimax location problems under constraints on the feasible location region. A tropical optimization problem is first considered, formulated in terms of a general semifield with idempotent addition. To solve the optimization problem, a parameter is introduced to represent the minimum value of the objective function, and then the problem is reduced to a parametrized system of inequalities. The parameter is evaluated using existence conditions for solutions of the system, whereas the solutions of the system for the obtained value of the parameter are taken as the solutions of the initial optimization problem. Then, a minimax location problem is formulated to locate a single facility on a line segment in the plane with a rectilinear metric. When no constraints are imposed, this problem, which is also known as the Rawls problem or the messenger boy problem, has known geometric and algebraic solutions. For the location problems, where the location region is restricted to a line segment, a new solution is obtained, based on the representation of the problems in the form of the tropical optimization problem considered above. Explicit solutions of the problems for various positions of the line are given both in terms of tropical mathematics and in the standard form.