Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to change Hostname? #139

Open
kenanyildiz opened this issue Jun 11, 2018 · 2 comments
Open

Is there a way to change Hostname? #139

kenanyildiz opened this issue Jun 11, 2018 · 2 comments

Comments

@kenanyildiz
Copy link

kenanyildiz commented Jun 11, 2018

Hello everyone,

I want to change hostname on lite-server but i did not find any way to do is on lite-server.

from: http://localhost:3000
to: http://127.0.0.1:8080

Thanks.

@zatchgordon
Copy link

zatchgordon commented Aug 28, 2018

Please keep in mind localhost is the same thing as 127.0.0.1
This means the only difference is the number after the colon (3000 vs 8080) a.k.a. the port number.

If you would like to change the port number, or any other settings, you can create a liteServer.config.js file. Inside this file you can place the code

{
  "port": 8000,    /* Change this port number to whatever you want e.g. 8080 */
  "files": ["./src/**/*.{html,htm,css,js}"],  /* maybe try removing the "/src" part of the path */
  "server": { "baseDir": "./src" } /* maybe try changing this to {"baseDir": "./"} => point to where you code is being loaded from */
}

Next, when running lite-server via the console you can run the command lite-server -c liteServer.config.js. You can name the config file whatever you would like and place it in whatever folder you would like. In the README file it suggests to put your config in a config folder. I keep it in the base folder.

After running the command you should be able to go to either http://127.0.0.1:8080 orhttp://localhost:8080.

@mikeerickson
Copy link

I have a similar need, as when I am working at Starbucks, the server wont start unless I use 127.0.0.1 Is there an alternate way of starting the server where accessing as localhost actually works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants