Difficulty
In server.properties set difficulty to peaceful, easy, normal or hard, and restart. To change it immediately without a restart, run difficulty hard in the console. Also update the file, so the setting you want is the one the server starts with.
Default gamemode
gamemode in server.properties sets the mode for players joining for the first time. It does not change players who have already joined. To change one player, use gamemode creative <name>. To change the default and existing players together, set force-gamemode=true, which puts every player into the default mode each time they join.
- gamemode=survival: default for new players
- force-gamemode=true: reset everyone to the default on join
- defaultgamemode adventure: change the default with a command
Hardcore
hardcore=true locks the difficulty to hard and puts players into spectator mode when they die. It is best set before the world is created, because the world remembers hardcore in its level data. For a hardcore SMP where players should be able to come back later, use a plugin or a scheduled reset rather than vanilla hardcore, which has no built-in way to revive players apart from an operator changing their gamemode.
Per-world settings
Vanilla has one difficulty for every dimension. Plugins such as Multiverse-Core let different worlds on the same server have their own gamemode and difficulty, which is how hubs, creative plots and survival worlds share one server.