Wildfires pose significant threats globally, affecting human life, wildlife, and ecosystems. The detrimental effects of these fires are often exacerbated by inaccuracies in fire positioning systems and delays in alarm response, leading to rapid and uncontrolled fire spread, consequently affecting emergency response times. This paper presents a novel, real-time wildfire localization system that employs an optimized trilateration technique. The technique leverages anchor node technology for the localization process. The Nelder-Mead (NM) optimization algorithm is utilized to augment the trilateration technique, thereby enhancing the accuracy of the estimated coordinates for unidentified nodes. The proposed localization algorithm is deployed using cloud computing and the Internet of Things (IoT) MQTT communication protocol. Simulation results demonstrate that the proposed method maintains accurate localization performance, with an enhancement in fire localization accuracy of up to 83% with the optimized trilateration based on the NM algorithm. As a result, the proposed approach offers potential time-savings in the early detection of wildfires, thus contributing to more efficient emergency response measures.