When it comes to comedy in the written format, some of the easiest to leverage comedy is banter. That is, just having your characters make some remarks and giving each other a hard time in such a way that it makes the reader laugh.
The strength of banter is that it can be inserted into pretty much any genre of storytelling. The weakness of banter is that it does not work unless you have very well established characters that your audience already cares about and identifies with. In other words, it only works if your writing is already good without it.
Also, the strength of the banter is directly proportional to the strength of your characterization.
He Who Fights With Monsters is a series pretty well known for it's banter, quite likely one of the best in the web-novel space for it. So, that might be a good place to look for inspiration. The only problem with this example is that you need to warm up to the characters before the banter starts really getting good, and it's not until the 3rd major arc that it's good enough to have you laughing in stitches.
The second strongest form of written comedy is brought about by situational comedy and literary irony. (The two often go hand-in-hand.) Situational comedy is usually a case where you make your characters uncomfortable for comedic effect. This is a form of comedy most effective in drama and slice-of-life stories, and one of the best uses of it I've seen is in Ascendance of a Bookworm.
The things to look out for with situational comedy are that you need to have your audience sympathies with the character in order for it to work, and the audience needs to be able to really buy that character's sense of embarrassment and discomfort. The reason it worked so well in Ascendance of a Bookworm is because it had so many serious characters in serious scenarios that just a little social embarrassment was enough to really make you as the reader feel their cringe.