@denis.royer Make sure you have your Site URL configured to use the URL w/ the subdirectory, e.g. http://example.com/mattermost/
. You might also need to change this:
location ~ /api/v[0-9]+/(users/)?websocket$
to this:
location ~ /mattermost/api/v[0-9]+/(users/)?websocket$