diff --git a/src/java/org/apache/nutch/webui/NutchUiServer.java b/src/java/org/apache/nutch/webui/NutchUiServer.java
index 79013df..bc7a945 100644
--- a/src/java/org/apache/nutch/webui/NutchUiServer.java
+++ b/src/java/org/apache/nutch/webui/NutchUiServer.java
@@ -16,6 +16,11 @@
  */
 package org.apache.nutch.webui;
 
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.PosixParser;
 import org.apache.wicket.protocol.http.WicketFilter;
 import org.apache.wicket.spring.SpringWebApplicationFactory;
 import org.mortbay.jetty.Handler;
@@ -29,15 +34,25 @@ import org.springframework.web.context.request.RequestContextListener;
 import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
 
 public class NutchUiServer {
-  private static final String APP_FACTORY_NAME = SpringWebApplicationFactory.class.getName();
+  private static final String APP_FACTORY_NAME = SpringWebApplicationFactory.class
+      .getName();
   private static final String CONFIG_LOCATION = "org.apache.nutch.webui";
+  private static final String CMD_PORT = "port";
+  private static Integer port = 8080;
 
   public static void main(String[] args) throws Exception {
+    CommandLineParser parser = new PosixParser();
+    Options options = createWebAppOptions();
+    CommandLine commandLine = parser.parse(options, args);
+
+    if (commandLine.hasOption(CMD_PORT)) {
+      port = Integer.parseInt(commandLine.getOptionValue(CMD_PORT));
+    }
     startServer();
   }
 
   private static void startServer() throws Exception, InterruptedException {
-    Server server = new Server(8080);
+    Server server = new Server(port);
     Context context = new Context(server, "/", Context.SESSIONS);
     context.addServlet(DefaultServlet.class, "/*");
 
@@ -61,4 +76,13 @@ public class NutchUiServer {
     return context;
   }
 
+  private static Options createWebAppOptions() {
+    Options options = new Options();
+    OptionBuilder.withDescription("Port to use for restful API.");
+    OptionBuilder.hasOptionalArg();
+    OptionBuilder.withArgName("port number");
+    options.addOption(OptionBuilder.create(CMD_PORT));
+    return options;
+  }
+
 }
