Home / Localhost / localhost:4000

localhost:4000 (Jekyll, Phoenix): not working and fixes

Port 4000 is the default for Jekyll, Phoenix and Apollo Server. How to open it and fix errors.

Open this address: http://localhost:4000This opens on your own computer. It only works if the program is running.

localhost:4000 is the default address for the Jekyll site server, Phoenix apps and a standalone Apollo Server. It only works while the server runs in a terminal on your computer.

localhost:4000 in a browser address bar reaches port 4000 on your computer, where Jekyll, Phoenix, Apollo is running

What runs on localhost:4000

Commands to start and test port 4000

Jekyll
bundle exec jekyll serve
Jekyll on another port
bundle exec jekyll serve --port 4001
Phoenix
mix phx.server
Jekyll with live reload
bundle exec jekyll serve --livereload
Jekyll on your network
bundle exec jekyll serve --host 0.0.0.0
Jekyll: open the browser for you
bundle exec jekyll serve --open-url

Find what is using port 4000

Run these in a terminal on your computer. Nothing is sent to this site.

If localhost:4000 will not open

Port 4000 is already in use
Another program is on port 4000. Find it with the tool below and stop it, or start yours on another port.
Jekyll: open the site from a phone or another computer
Jekyll’s manual gives the default host as 127.0.0.1, so only your own computer can reach it. Start it with bundle exec jekyll serve --host 0.0.0.0 and open your computer’s IP address with :4000.
Jekyll: the page does not refresh after a change
Add --livereload so the browser reloads when a file changes. Changes to _config.yml still need a restart.
Phoenix: works on this computer only
A new Phoenix app binds to the loopback address in config/dev.exs: http: [ip: {127, 0, 0, 1}, port: 4000]. Change the ip to {0, 0, 0, 0} to reach it from other devices on your network.
Phoenix: use another port
Change port: 4000 in the same line of config/dev.exs, then restart mix phx.server.
Jekyll: Could not locate a Gemfile
You started Jekyll outside your site folder. Open the folder with the _config.yml file and run the command again.
This site can’t be reached (ERR_CONNECTION_REFUSED)
The server is not running. Start it and keep that terminal open. See the full checklist.
Works on your computer, not on your phone
Start the server on all network addresses and use your computer’s IP address. See how to open localhost from your phone.

Other ports like 4000

PortUsually used by
localhost:3000React, Next.js, Express
localhost:5173Vite dev server
localhost:4200Angular dev server
localhost:5000Flask
localhost:8000Django, PHP, Python
localhost:8080Tomcat, Spring Boot, Docker
localhost:8888Jupyter Notebook

Questions about localhost:4000

What runs on localhost:4000?
Most often a Jekyll site, a Phoenix app or an Apollo GraphQL server. The terminal shows which one.
How do I change Jekyll's port?
Add --port 4001 to the command, or set port in _config.yml.
Why can my phone not open localhost:4000?
Jekyll and Phoenix both listen on 127.0.0.1 by default. Start them on 0.0.0.0 and use your computer’s IP address.
Is it Jekyll or Phoenix on my port 4000?
Check with the port tool below. A ruby process means Jekyll, a beam process means Phoenix.

Updated 2026-11-10. Sources: Debian manual: jekyll serve

Free tools that help

Related pages