How to override the default port on 3000?

304 views
Skip to first unread message

action

unread,
Feb 25, 2014, 9:21:05 AM2/25/14
to clo...@googlegroups.com
I do like this:
#lein new compojure-app guestbook
#cd guestbook
#lein ring server

The server runs on port 3000 by default. 
But how to override the default port?
Such as runs on port 80?

thinks


Timothy Washington

unread,
Feb 25, 2014, 9:30:42 AM2/25/14
to clo...@googlegroups.com
Try this. 

lein ring server-headless <pick-your-port>  ;; port 80 usually requires root permissions


Tim Washington 


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jason Stewart

unread,
Feb 25, 2014, 9:23:26 AM2/25/14
to clo...@googlegroups.com
The lein-ring plugin accepts a port number as an argument:

lein ring server 8080

Note, that in order to bind to port 80, you will need elevated (root) privileges.


On Tue, Feb 25, 2014 at 9:21 AM, action <action...@gmail.com> wrote:

Josh Kamau

unread,
Feb 25, 2014, 9:59:09 AM2/25/14
to clo...@googlegroups.com
you can also change this line on your project.clj

:ring {:handler myproject.handler/app :port 8080}

Josh

Rob Day

unread,
Feb 25, 2014, 12:26:17 PM2/25/14
to clo...@googlegroups.com
If you do want to use port 80, it's generally safer to use a reverse
proxy like nginx to listen on port 80 and forward to port 3000 - that
way your code doesn't need root privileges and is less of a security
headache.
Robert K. Day
rober...@merton.oxon.org

action

unread,
Feb 26, 2014, 8:16:38 AM2/26/14
to clo...@googlegroups.com
It's ok! Think you for all the answer!

在 2014年2月25日星期二UTC+8下午10时21分05秒,action写道:
Reply all
Reply to author
Forward
0 new messages