In this letter, we study a discrete optimization problem, namely, the maximization of channel capacity in fluid multiple-input multiple-output (fluid-MIMO) systems through the selection of antenna ports/positions at the transmitter and the receiver. First, we present a new joint convex relaxation (JCR) problem by using an upper bound on the channel capacity and exploiting the binary nature of optimization variables. Then, we develop and analyze two optimization algorithms with different performance-complexity tradeoffs: the first is based on JCR and reduced exhaustive search (JCR&RES), while the second on JCR and alternating optimization (JCR&AO). Finally, numerical results show that the proposed algorithms significantly outperform two baseline schemes, the random port selection and the conventional MIMO setup.