Usually you can publish a draft version of your paper, but not the version that is edited by the journal. They should be mostly the same, though.
I'm not sure if some journals like Nature prevent or discourage you from doing this.
Some journals allow us to post the post-review paper (at any rate, the changes are usually mostly cosmetic).