I built a laravel project in my desktop folder and running it using valet on project-name.dev . How can I access it from local network ? My IP address is 192.168.1.5 ,I'm using a mac and I tried below code but It gives me a error in my project. Is there any different solution ?
php artisan serve --host 192.168.1.5 --port 80
Any help will be appreciated!!
You forgot the equals sign in your command. It should work like this:
php artisan serve --port=80 --host=192.168.1.5
To connect any of your local network devices to your mac you can type into their browser's address bar:
192.168.1.5:80
You can follow the step below
Make valet site unsecure 1st using valet unsecure sitename
Run valet share
A publicly accessible URL will be inserted into your clipboard and is ready to paste directly into your browser. That's it.
Please note
valet share does not currently support sharing sites that have been
secured using the valet secure command.
https://laravel.com/docs/5.6/valet#sharing-sites
You can do that by using --host=0.0.0.0. By using 0.0.0.0, you don't need to hardcode your IP address. It will automatically point to your IP address, even if it changed at some point, maybe when you connect to a different network.
So you type
php artisan serve --host=0.0.0.0 --port=80
You can now access your app using your browser or on another computer in the same network.
http://192.168.1.5:80
Related
If I run laravel on localhost, it shows me only file, how to fix this
The main index.php file is in Laravel's public/ directory. If you visit http://localhost/Employee/public, you'll likely see your Laravel site.
If you point your webserver's DocumentRoot at that directory, you'll be able to visit the app at http://localhost/. If you want to run multiple apps locally, you'll want to start playing with virtualhosts.
Alternatively, consider using Laravel's Valet, Sail, or Homestead options for local development; each will handle this sort of thing for you. Sail is Laravel's current recommendation.
You can use a web server such as Apache or Nginx to serve your laravel applications. If you have PHP 5.4+ and would like to use PHP's built in development server you may use the serve artisan command:
cd /project_directory
php artisan serve
By Default it will run application on port 8000
If you want to change to other port specify port number like
php artisan serve --port=8080
It will run your application on the PHP development server on localhost:8080
Docs: https://laravel.com/docs/4.2/quick#local-development-environment
I googled a lot about solution to serve with https. Even I tried ngrok, but it doesn't work properly.
Below is the code of ngork.
php artisan serve
cd <path-to-ngrok>
./ngrok http localhost:8000
I am sure Laravel has artisan to serve HTTPS.
One solution is to use Symfony's 'serve' command instead of artisan serve.
https://symfony.com/download
Install the Symfony CLI locally (I used the homebrew install instructions) and then ran symfony serve in my Laravel root dir. This serves the site under https by default.
it's a standard protocol that HTTPS is listening on port 443, you can simply run the command to listen on that port
php artisan serve --port=443
by the way, php artisan serve is for development use only and ssl certificate is for production environment and both of them have no work relation at all as both serve their purpose differently...
although you can customize your web server to install the SSL certificate and and listening on custom port but you are breaking the standard and the public may doubt and not able to accept it...
I use mac High Sierra I want to change url from
http://127.0.0.1:8000/ to test.dev
when I run phpartisan serve
How can I do something like this,
I'm using Laravel & MAMP
If you are using MAMP, you do not need to use
php artisan serve
Just put inside your html/www root and create virtual host.
I have an application which i am using 'php artisan serve' command to run it on my mobile. I want to test it on my mobile but i have an API which requires HTTPS. So how can i configure this? I want to test this before I put this live.
Here is how my artisan command looks like:
php artisan serve --host=192.168.1.18 --port=80
The IP is my local machines IP Address which i am accessing from my mobile.
I have tried looking up google but i couldn't find the answer i was looking for.
Thanks
You can use self-signed SSL for own server.
1 - Download the certificate.
2 - Add or edit this line in php.ini config:
curl.cainfo = "[path_to_cerfificate]\cacert.pem"
3 - Then restart your server
Done.
Just installed Lumen framework.
hit the link http://localhost/lumen/public/ in my browser and got this following error, anyone got any idea about it?
Traced it back to the app.php file in bootstrap folder.
if You want to access lumen project without "php artisan serve"
$app->run(); replace with
$request = Illuminate\Http\Request::capture();
$app->run($request);
from this path yourlumenproject/public/index.php
Open your terminal in the root folder run the following command php artisan serve.
Lumen development server started on http://localhost:8000/
if you want to serve your app in local development you can do this :
php -S localhost:8000 -t public/
and it will serve in localhost in port 8000. hope this help.
Note : I'm using Laravel Framework version Lumen (5.2.4) (Laravel Components 5.2.*)
At the moment Lumen only runs in the domain root.
(I've submitted a PR that fixes this but it has yet to be merged)
You have to create a Virtual Host on your local webserver and point the document root of that to the public directory. After that you can access your app with something like: http://lumen.dev.
Guide for Virtual Hosts with nginx
Guide for Virtual Hosts with Apache
A simple alternative to setting this up manually is Laravel Homestead. It is an official Vagrant box made for Laravel, that allows you to easily get your development environment up and running.