As of the Halloween Update:
You don't have to worry about Zombie Pigmen (they are, after all, neutral mobs until provoked).
Ghasts can safely be kept out by restricting yourself to not using any of the 4x4x4 (or larger!) areas that they need to spawn. Keep a tight ceiling, and you'll be fine.
Since version 1.5, this hasn't been much of an issue, as that release introduced a rule in the mobs' AI to avoid rails unless they are chasing after the player. Although I have still found Zombie Pigmen appearing on the tracks, this is now not as much of an issue as it was in previous versions.
Zombie Pigmen are able to spawn on rail tracks, so removing the walking path on the side will do nothing. But as has been mentioned, adding blocks above your tracks will prevent them from spawning and help keep them from walking onto your tracks 100% of the time. This is a common "fix", and has been around for quite a while, and it doesn't seem like the developers have any plans to stop this fix from being possible.
The following blocks can safely be placed above the tracks, and will not suffocate you:
- Glass panes (I would really recommend this one, since they are "cheaper" than glass blocks, works with stained glass panes as well)
- Glass blocks (works with stained glass as well)
- Glowstone blocks
- Leaf blocks
- Iron bars
- Fences (of all materials)
- Half-slabs (of all materials, note that they must be single, NOT double slabs)
- Stairs (of all materials)
- Trap doors
- Pistons (both extended and retracted)
There are other blocks that would work, such as Beds, Chests, TNT, or Enchantment Tables, but I have excluded them from the list due to being impractical.
Best Answer
There are several ways you can try to stop Zombie Pigmen from spawning in the nether by breaking their spawn rules:
You can't do anything regarding light levels as Zombie Pigmen spawn in any light condition.
*You can do this to the surrounding area of an overworld portal to prevent them from spawning there.