简体   繁体   中英

How to run Laravel project on local IP address?

I want to run my Laravel project on my local IP address like from an eg 192.168.1.105

By the getting reference from this link , I found below code for that.

sudo php artisan serve --host 192.168.1.101 --port 80

But, I am using window system so I run below code

php artisan serve --host 192.168.1.101 --port 80

But I am getting below error massage.

C:\xampp\htdocs\projects\xyz-project>php artisan serve --host 192.168.1.105 --port 80
        
   ErrorException 

  chdir(): No such file or directory (errno 2)

  at C:\xampp\htdocs\projects\xyz-project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:43
     39▕      * @throws \Exception
     40▕      */
     41▕     public function handle()
     42▕     {
  ➜  43▕         chdir(public_path());
     44▕ 
     45▕         $this->line("Starting Laravel development server: http://{$this->host()}:{$this->port()}");
     46▕ 
     47▕         $environmentFile = $this->option('env')

  1   C:\xampp\htdocs\projects\xyz-project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:43
      chdir("C:\xampp\htdocs\projects\xyz-project\public")

  2   C:\xampp\htdocs\projects\xyz-project\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
      Illuminate\Foundation\Console\ServeCommand::handle()

C:\xampp\htdocs\projects\xyz-project>

在此处输入图像描述

So any solutions for this to run on IP address?

Yes you can localhost ip address is: 168.0.0.1

On php artisan serve ----- 168.0.0.1:8000 or localhost:8000

But still you can make your own port by using artisan command ---

php artisan serve -port=9000

New you can use 168.0.0.1:9000 instead of default 8000 port

Our I think there is mistake in your command add = after -port

php artisan serve --host 192.168.1.105 -port=80

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM