How you turn PvP off depends on your Minecraft version. On newer versions PvP is a game rule. On older versions it's a setting in server.properties.

Newer versions (1.21.9 and later, including 26.x)

Run this in the console:

Game rules are saved with the world, so this stays after a restart. On Paper, Purpur and Spigot each world has its own game rules. Run the command in each world you want to change, or use a plugin.

Older versions (1.21.8 and earlier)

  1. Stop the server.
  2. Open server.properties and set pvp=false (off) or pvp=true (on).
  3. Save and start the server.

Not sure which applies? Run gamerule in the console and look for pvp in the list. If it's there, use the game rule.

PvP in some places only

For a PvP arena or a safe spawn, use a region plugin: