In this paper, we investigate an unmanned aerial vehicle (UAV)-enabled secure communication scenario that a cluster of UAVs performs a virtual non-uniform linear array (NULA) to communicate with a base station (BS) in the presence of eavesdroppers (Eves). Our goal is to design the UAV topology, trajectory, and precoding to maximize the system channel capacity. To this end, we convert the original problem into equivalent two-stage problems. Specifically, we first try to maximize the channel gain by meticulously designing the UAV topology. We then study the joint optimization of the trajectory and precoding for total transmit power minimization while satisfying the constraints on providing quality of service (QoS) assurance to the BS, the leakage tolerance to Eves, the per-UAV transmit power, the initial/final locations, and the cylindrical no-fly zones. For the UAV topology design, we prove that the topology follows the Fekete-point distribution. The design of trajectory and precoding is formulated as a non-convex optimization problem which is generally intractable. Subsequently, the non-convex constraints are converted into convex terms, and a double-loop search algorithm is proposed to solve the transmit power minimization problem. Introduce random rotation offsets so as to perform a dynamic stochastic channel to enhance the security. Numerical results demonstrate the superiority of the proposed method in promoting capacity.