Note that if you daisy chain your devices they are not technically "stubs", they are just segments of the same bus.
You don't need any wires in your enclosures. Run two traces in parallel from input to output connector with a stop in between at transceiver pins. Use online impedance calculator like this one for example.
UPDATE
Since you revised the question and mentioned that you want to use wires instead of PCB traces, the answer would be to use short pieces of twisted wire inside, as I already suggested in comments. However the following line in revised question is confusing (and seems not only to me):
main line I mean what normally is a cable that runs along all stubs. I searched for examples, but I can only find RS485 lines where the stubs are 'tapped' from the RS485 (main) line. But mine is only the wires between each two DB9 connectors inside an enclosure
There is a reason you often see connections in the middle shown as "taps" in various RS-485 documents, like in the pictures below.
Although electrically this is identical to the schematics in the question, it is done to emphasize actual physical layout. The goal is to minimize stub length, as shown in the middle picture.
If the "main line" between input and output connector is made with PCB traces they should be run straight trough corresponding pins of the transceiver. If the connection is done with twisted pairs they should be joined as a tap as close to transceiver pins as possible. Below are examples for both PCB traces and wire tap.
Now, after all this said, RS-485 is not very well suitable for this application (as in updated question). There is minimum node spacing defined by combined node capacitance per line segment. See #10 in this
design guide. By piling up directly connected modules you might quickly exceed this capacitance.
FWIW, I never faced this problem, but on the other hand I haven't seen the designs like this either. Interesting that these questions one, two are still without definite answers.
There are alternatives worth considering. At your distances single-ended UART should work without any problems whatsoever. There was a discussion on similar solution recently. In that case the OP wanted uni-directional bus. If you want bi-directional single-master communication you can design your own protocol to make sure slave nodes will not transmit simultaneously. If you want bi-directional multi-master configuration you can use a simple transistor circuit to convert pull-pull UART output into open-drain, then wire bus with pull-ups, I2C-like.
UPDATE 2
If you want to try SPI then you have to control 15 (per your question) SS lines. This, of course, removes the need in software addressing and collision prevention.
Note, that you don't actually need 15 GPIO pins for this. If you put all your slave modules into same enclosure then a single 74HCT154 demultiplexer and 4 GPIO is all you need.
However if you want the flexibility of modular design then you can route 4 address lines through DB9 connectors and add simple 4-bit address decoder circuits to your modules with DIP switches to set individual addresses. Here is an example of a decoder with two cheap logic chips and 4 positions SPDT switch.