in a command block or similar where: @a is to execute on all players at thier coords the playsound command with entity.spider.death being the sound you want and @p to target the nearest player (again said player).
It's more about where the sound gets generated (emitted from) and who can hear it (the players).
You can't REALLY play a server-wide sound as you probbably think, like a magic sound that everyone gets to hear wherever they are, believe me, i tried, at best you can play a sound with a very lalrge volume radius, which basically ddictate the reange the sound will be heard from.
But to resume, you can only "summon" a sound emitter at certain coordinates or entities, only then to make said sound hearable to the nearest player to said sound source, that's what both the @a and @p in my command does. I may have the syntax a bit wrong since i typed that from memory but the main idea is there. You could just hop on your server and test it if it does what you want it to do.