summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-07-20 16:00:21 -0400
committerJames Moger <james.moger@gitblit.com>2011-07-20 16:00:21 -0400
commit18422ea861b3e6e4ff3a2ffe3364343deb538b5d (patch)
treeb93d30fdb603e256e002010c192f929df3e4d66d
parent330247866e931d5e5f93999db9947bc2fc1fc9ee (diff)
downloadgitblit-18422ea861b3e6e4ff3a2ffe3364343deb538b5d.tar.gz
gitblit-18422ea861b3e6e4ff3a2ffe3364343deb538b5d.zip
Default to port 8443 for GO to be more nix friendly (issue 12)
-rw-r--r--distrib/gitblit.properties6
-rw-r--r--src/com/gitblit/GitBlitServer.java20
2 files changed, 24 insertions, 2 deletions
diff --git a/distrib/gitblit.properties b/distrib/gitblit.properties
index 73a1747c..73516d48 100644
--- a/distrib/gitblit.properties
+++ b/distrib/gitblit.properties
@@ -282,16 +282,20 @@ server.tempFolder = temp
server.useNio = true
# Standard http port to serve. <= 0 disables this connector.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 80 or 8080
#
# SINCE 0.5.0
# RESTART REQUIRED
server.httpPort = 0
# Secure/SSL https port to serve. <= 0 disables this connector.
+# On Unix/Linux systems, ports < 1024 require root permissions.
+# Recommended value: 443 or 8443
#
# SINCE 0.5.0
# RESTART REQUIRED
-server.httpsPort = 443
+server.httpsPort = 8443
# Specify the interface for Jetty to bind the standard connector.
# You may specify an ip or an empty value to bind to all interfaces.
diff --git a/src/com/gitblit/GitBlitServer.java b/src/com/gitblit/GitBlitServer.java
index 61f681f0..92305fc7 100644
--- a/src/com/gitblit/GitBlitServer.java
+++ b/src/com/gitblit/GitBlitServer.java
@@ -151,6 +151,9 @@ public class GitBlitServer {
params.port, bindInterface));
httpConnector.setHost(bindInterface);
}
+ if (params.port < 1024 && !isWindows()) {
+ logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
+ }
connectors.add(httpConnector);
}
@@ -171,6 +174,9 @@ public class GitBlitServer {
params.securePort, bindInterface));
secureConnector.setHost(bindInterface);
}
+ if (params.securePort < 1024 && !isWindows()) {
+ logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
+ }
connectors.add(secureConnector);
} else {
logger.warn("Failed to find or load Keystore?");
@@ -255,7 +261,7 @@ public class GitBlitServer {
*
* @param useNIO
* @param port
- * @return an http cnonector
+ * @return an http connector
*/
private static Connector createConnector(boolean useNIO, int port) {
Connector connector;
@@ -273,6 +279,9 @@ public class GitBlitServer {
connector.setPort(port);
connector.setMaxIdleTime(30000);
+ if (port < 1024 && !isWindows()) {
+ logger.warn("Gitblit needs to run with ROOT permissions for ports < 1024!");
+ }
return connector;
}
@@ -306,6 +315,15 @@ public class GitBlitServer {
connector.setMaxIdleTime(30000);
return connector;
}
+
+ /**
+ * Tests to see if the operating system is Windows.
+ *
+ * @return true if this is a windows machine
+ */
+ private static boolean isWindows() {
+ return System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
+ }
/**
* The ShutdownMonitorThread opens a socket on a specified port and waits