In this post,we are sharing a tip to change Port number for Octopress. By-default when we run the command
rake preview in Octopress setup ,it runs on port number 4000 .
Here in this practical we will change the default port no. 4000 of Octopress to some other port no.
Note: Always select custom port number above well known port number (1 to 1024). If two or more application/service has same port number then it will not work properly.
To change the port number for Octopress,follow the given below steps
Step 1: First check,the port number which you have decided,should not be used by any service/application in system. To know about in used port number, run
netstat -tanp |grep new-port-number (For TCP based Protocol) netstat -uanp |grep new-port-number (For UDP based Protocol)
Example : Here,in this example we are checking is port number 4400 free.
netstat -tanp |grep 4400 (For TCP based Protocol) netstat -uanp |grep 4400 (For UDP based Protocol)
Step 2: Change the port number in file called Rakefile
Change Directory to path where you have saved the code of Octopress in your system.
Edit the Rakefile and replace the value in
server_port = "4000" to
server_port = "4400"
vi Rakefile server_port = "4400"
Step 3: Now stop and start the command
rake preview .
Now open the Web Browser and type the system IP address along with new port number.
See the below screenshot
Project URL : http://octopress.org/