In ancient days, Peoples didn't have any telescope or observatory to study our solar system. They used their naked eye to observe the position of planets and stars. Historically, Greeks astronomers had a remarkable talent. They were the first who said the Earth is spherical.

Aristotle was a famous Greek astronomer, he believed that Earth is at the center of our solar system. Another astronomer not famous as Aristotle, Aristarchus claimed that the Sun is at the center and today, we know that Aristarchus was right.

Aristarchus was the first person (around 250 B.C.) who gave a proper method to find the distance between earth and sun, his measurement was not so accurate but the method he used was brilliant. He took that position when the moon was half-illuminated and then he noticed that the sun, moon, and earth was forming a right angle. He estimated the angle 87° not far from the actual value 89.83°.

At his time, there was no geometry. So, he used a similar way -
d = distance between moon and earth
D = distance between earth and sun

d\D = 3° / 57.29° = 1/20
d = 20 ✕ D

i.e. the distance between sun and earth is 20 times the distance between earth and moon. This is not true, it is 400 times but the idea was remarkable. Of course, he didn't know the distance between the moon and earth. He only compared both distances and nobody knows, how he estimated the angle.

let's know how he measured the diameter of the sun. First of all, he took that position when earth, moon, and sun were linear. He saw that they form a triangle -

With the help of two triangles above figure-

Dm / (Re - R) = Ds / (Rs - Re)

Dm = Distance between moon and earth

Ds = Distance between earth and sun

R = distance between shadow area of earth on radius of moon's position

DDs = Rm / Rs

⇒ Rm / Rs =  (Re - R) / (Rs - Re)

⇒ (Rs - Re) / Rs = (Re -R) / Rm

⇒ 1 - (Re / Rs) = (Re / Rm) - (R / Rm)

⇒ 1 + (R / Rm) = (Re / Rm) + (Re / Rs)

⇒ 1 + (R / Rm) = Re / Rs ((Rs / Rm) + 1)

⇒ Rs / Re = ((Rs  / Rm) + 1) / (1 + (R / Rm))

⇒ Rs / Re = ( 20 + 1) / ( 2 + 1 ) = 21 / 3 = 7
Rs = 7 Re

(He already calculated that R / Rm = 2.)
Therefore he said that, "the diameter of the sun is 7 times the diameter of the earth". Of course today we know that it's 109 times. In this way Aristarchus measure the distance to the sun