diff --git a/README.md b/README.md
index a6463c2..f765e67 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,7 @@ Key | Description
--- | ---
game | Which game server to launch, see above
path | Folder path to game server
+baseUrl | URL path used to serve the application, default is '/'. Must end with `/`
port | Web port to use
host | IP or Hostname to listen on
type | Which kind of server to use, can be 'linux', 'windows' or 'wine'
diff --git a/app.js b/app.js
index e8ddd73..3ceb4c9 100644
--- a/app.js
+++ b/app.js
@@ -17,7 +17,6 @@ var Settings = require('./lib/settings')
var app = express()
var server = require('http').Server(app)
-var io = require('socket.io')(server)
setupBasicAuth(config, app)
@@ -27,8 +26,6 @@ app.use(bodyParser.urlencoded({ extended: false }))
morgan.token('user', function (req) { return req.auth ? req.auth.user : 'anon' })
app.use(morgan(config.logFormat || 'dev'))
-app.use(serveStatic(path.join(__dirname, 'public')))
-
var logs = new Logs(config)
var manager = new Manager(config, logs)
@@ -40,11 +37,22 @@ mods.updateMods()
var settings = new Settings(config)
-app.use('/api/logs', require('./routes/logs')(logs))
-app.use('/api/missions', require('./routes/missions')(missions))
-app.use('/api/mods', require('./routes/mods')(mods))
-app.use('/api/servers', require('./routes/servers')(manager, mods))
-app.use('/api/settings', require('./routes/settings')(settings))
+var baseUrl = config.baseUrl || '/'
+var router = express.Router()
+
+router.use('/api/logs', require('./routes/logs')(logs))
+router.use('/api/missions', require('./routes/missions')(missions))
+router.use('/api/mods', require('./routes/mods')(mods))
+router.use('/api/servers', require('./routes/servers')(manager, mods))
+router.use('/api/settings', require('./routes/settings')(settings))
+router.use('/', require('./routes/main')(baseUrl))
+router.use(serveStatic(path.join(__dirname, 'public')))
+
+app.use(baseUrl, router)
+
+var io = require('socket.io')(server, {
+ path: baseUrl + 'socket.io'
+})
io.on('connection', function (socket) {
socket.emit('missions', missions.missions)
diff --git a/config.js.example b/config.js.example
index 2731db8..2a8a22b 100644
--- a/config.js.example
+++ b/config.js.example
@@ -1,6 +1,7 @@
module.exports = {
game: 'arma3', // arma3, arma2oa, arma2, arma1, cwa, ofpresistance, ofp
path: 'path-to-arma3-directory',
+ baseUrl: '/',
port: 3000,
host: '0.0.0.0', // Can be either an IP or a Hostname
type: 'linux', // Can be either linux, windows or wine
diff --git a/public/index.html b/public/index.html
index 7673fc9..a37ca65 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,17 +1,18 @@