localhost:4000

Port 4000 is the default port for Jekyll (Ruby static site generator) and Phoenix Framework (Elixir). If you're building a Jekyll blog, GitHub Pages site, or Phoenix web application, this is your development URL.

Open dev server: http://localhost:4000

What Uses Port 4000?

ToolLanguageStart Command
JekyllRubyjekyll serve
PhoenixElixirmix phx.server
GatsbyJavaScriptgatsby serve
DocusaurusJavaScriptnpm run serve
HugoGohugo server -p 4000

Jekyll Development

Jekyll powers GitHub Pages and is one of the most popular static site generators.

# Install Jekyll
gem install jekyll bundler

# Create new site
jekyll new my-blog
cd my-blog

# Start development server
bundle exec jekyll serve

# With live reload
bundle exec jekyll serve --livereload

# Access at http://localhost:4000

Jekyll Configuration

# _config.yml - change port
port: 4000
host: localhost
livereload: true

# Or via command line
jekyll serve --port 4001

Phoenix Framework

Phoenix is an Elixir web framework known for real-time features and performance.

# Create new Phoenix app
mix phx.new my_app
cd my_app

# Setup database
mix ecto.create

# Start server
mix phx.server

# Access at http://localhost:4000

Phoenix Configuration

# config/dev.exs
config :my_app, MyAppWeb.Endpoint,
  http: [port: 4000],
  debug_errors: true,
  code_reloader: true

Change Default Port

# Jekyll
jekyll serve --port 4001

# Phoenix (environment variable)
PORT=4001 mix phx.server

# Gatsby
gatsby serve --port 4001

Troubleshooting

ProblemSolution
Port in useUse --port 4001 or kill process
Jekyll not foundgem install jekyll bundler
Permission deniedFix gem permissions, don't use sudo
Page not updatingEnable livereload or restart server