Exact confidence intervals and regions are proposed for the location and scale parameters of the Rayleigh distribution. These sets are valid for complete data, and also for standard and progressive failure censoring. Constrained optimization problems are solved to find the minimum-size confidence sets for the Rayleigh parameters with the required confidence level. The smallest-area confidence region is derived by simultaneously solving four nonlinear equations. Three numerical examples regarding remission times of leukemia patients, strength data and the titanium content in an aircraft-grade alloy, as well as a simulation study, are included for illustrative purposes. Further applications in hypothesis testing and the construction of pointwise and simultaneous confidence bands are also pointed out.