A better design of gas supply chains may lead to a more efficient use of locally available resources, cost savings, higher energy efficiency and lower impact on the environment. In optimizing the supply chain of liquefied natural gas (LNG), compressed natural gas (CNG) or biogas for smaller regions, the task is to find the best supplier and the most efficient way to transport the gas to the customers to cover their demands, including the design of pipeline networks, truck transportation and storage systems. The analysis also has to consider supporting facilities, such as gasification units, truck loading lines and CNG tanking and filling stations. In this work a mathematical model of a gas supply chain is developed, where gas may be supplied by pipeline, as compressed gas in containers or as LNG by tank trucks, with the goal to find the solution that corresponds to lowest overall costs. In order to efficiently solve the combinatorial optimization problem, it is linearized and tacked by mixed integer linear programming. The resulting model is flexible and can easily be adapted to tackle local supply chain problems with multiple gas sources and distributed consumers of very different energy demands. The model is illustrated by applying it on a local gas distribution problem in western Finland. The dependence of the optimal supply chain on the conditions is demonstrated by a sensitivity analysis, which reveals how the model can be used to evaluate different aspects of the resulting supply chains.