public void reconfigure ( final String config ) { try { final File tempFile = File . createTempFile ( "nginx" , ".conf" ) ; try { FileHelper . write ( tempFile , config ) ; final Execed process = Exec . rootUtility ( new File ( binPath , "nginx-reconfigure" ) . getAbsolutePath ( ) , tempFile . getAbsolutePath ( ) ) ; process . waitForExit ( new Timeout ( 30 , TimeUnit . SECONDS ) . start ( ) , 0 ) ; } finally { FileUtils . deleteQuietly ( tempFile ) ; } } catch ( IOException e ) { throw new RuntimeException ( "Error executing nginx-reload command" , e ) ; } reload ( ) ; }
Rewrite the nginx site configuration and reload