Sihanoukville is a beach resort in Cambodia.
North/East towards Phnom Penh, Kampot
The CamBrew factory is located at the end of the city at the National Road 4 to Phnom Penh. You can hitch right in front of it. It's only about 4 km walking, but the road leads over a steep hill and on a sunny day, this can be extremely exhausting, so you might want to take a tuk-tuk. From here you can also hitch towards Kampot by National Road 3.
There are many trucks coming from the port and going straight to Phnom Penh, so if that's your destination, you have a good chance to get a direct lift. The trip takes 5-6 hours, depending on the vehicle and if using the national road.
If you want to get to Phnom Penh faster there's the new Expressway 4 that was opened in 2022. It only takes 2.5-3 hours to the capital from Sihanoukville. To make sure you'll be taken by this road you should start hitchhiking behind the roundabout where E4 starts. It's located more than 10km from the city centre and the only way to get there is by ordering a tuk tuk using Passapp or Grab.
Accommodation and Sleep
It's possible to sleep on the rocks, south of Serendipity beach. Only do that, if you are sure it won't rain that night though.
For wild camping, you can go to Hun Sen beach. It's about 6 km from the center, but most of the day and all night, you will have the beach for you alone.