Epoxy will do it for sure.
Without seeing what you are doing, my only advise would be to have the screw through the outside and have the nut already attached with the epoxy on the bottom, then offer the two parts together. This way, you make sure the nut is exactly where you want it. Once set, you should be able to unscrew the screw and add more epoxy to the nut if neccesary. You can put vaseline inside the nut or the end of the screw to stop it sticking