How to set up React-Laravel project with out php artisan serve? - php

I have created a react-laravel project using laravel-mix. Right now I am run project using
npm run watch
php artisan serve
So by this, I access project by : http://localhost:8000
I have also worked in laravel. In laravel, if we want to access project without php artisan serve then we can access using : http://localhost/project_name/public.
Now my question is, how can I access/execute react-laravel project without php artisan serve? Is there any kind of way to access/execute project without port? Because I want to set up react-laravel on live server and I don't want to continue open terminal on server after code uploading.
I will really appreciate your feedbacks.

There are a multitude of ways to set up a laravel project. and it has nothing to do with the frontend suite you use whether its React or Vue, I will give you 2 options here to run a laravel application.
1. vagrant/homestead
Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
Doc Link
2. XAMPP/WAMP/ or any LAMP stack
XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.
Link
Personally I prefer Laravel Homestead since it contains everything out of the box for laravel Development. like PHP, Nginx, MariaDB, Node, etc...

Related

Does laravel require a separate web server to run?

I am learning laravel for a school research project and am currently stuck at this. I have installed xampp and composer so far, I installed xampp to make use of the php.exe file that composer asks for, however, I realized that when I execute this command "php artisan serve" I am able to launch the new laravel project without having xampp running, does this mean that laravel does not require a separate server?
does this mean that laravel does not require a separate server?
Not really, php artisan serve is only meant to be used for developing environment since it uses PHP's built-in webserver.
Taken from its documentation
This web server was designed to aid application development. It may
also be useful for testing purposes or for application demonstrations
that are run in controlled environments. It is not intended to be a
full-featured web server. It should not be used on a public network.
In production you should use a better webserver such as nginx.

laravel not working without php artisan serve command

I am currently working on laravel 5.3. My team mate installed laravel on his machine using composer. In my machine i also have installed composer, and installed a larvel project using laravel installer, which was installed by composer. Now when i got the archive file o fproject installed by my team mate on my machine i run
php artisan cache:clear,
php artisan route:clear,
php artisan key:generate,
php artisan serve
commands and clicked the link provided (i.e localhost:8000 ) in terminal,by this project is running fine but, but when i am entering the url in the browser like
localhost\laravel\public it is not running correctly.
As local dev is always susceptible to configuration issues. I would also suggest your team look into a proper virtualization solution using vagrant/Homestead, More information and documentation available # enter link description here
The advantage is that once the project is configured you never need to worry about these system-specific occurrences and all team members can work on the same underlying system specs.
Note that you can use real domains (e.i project-name.dev.yourdomain.com) by just pointing them to the 10.x.x.x ip range.
Just Give the permissions to these directories
storage
bootstrap/cache
and the work is done.

What are the correct steps to deploy a production laravel 5.2 app?

I am using laravel 5.2 to develop app.
As of now I am using php -S localhost:8888 -t public to deploy the test development app.
I know that I have to change configuration file .env for production.
But itseams I can't use php artisan serve or php -S localhost:8888 -t public to deploy the app as production app.
I am using WAMP in my machine. Currently I placed my laravel app in C:\wamp\www\laravel.
What are the correct steps to deploy my laravel 5.2 app?
php artisan serve creates a local, development, very basic HTTP server and is not for production. It won't handle more than a handful of visits and will break quickly, and isn't secured in the way Apache or Nginx are.
Based on your directory path C:\wamp\www\laravel, I guess you are using a WAMP server? The A in WAMP is Apache - the web server you use instead of php artisan serve.
Setting up the site on a production server will vary based on your setup, but the general steps will look like:
You should just put your project files straight into in your WAMP directory
Run composer install to install the dependencies.
Edit the database and other vars in your .env file.
Ensure that WAMP is running and the site is configured and you should should be good to go.
If you don't have much server experience and just want to securely and simply host a Laravel app, I would strongly suggest checking our Laravel Forge - it does everything and your site will be on the public Internet within 10 minutes.

Laravel - how to serve a new laravel project to browser

This is the first time I've used a PHP framework.
I've been following the Laravel documentation to install Composer and Laravel, and everything seems to have gone smoothly.
But now I've finished the installation/configure instructions, and I have created a project, I can't see any instructions on how to serve my application so it's viewable via a browser?
I have used Ruby on Rails before, which came with an easy way to get an instance of the application running via a built-in web server.
Is there something similar with Laravel, or do I need to somehow configure my standard Apache instance to serve the application?
I'm guessing there is something I've overlooked or misunderstood in the documentation.
yes, you can do it by using following in your terminal.
open your terminal, and navigate to directory where you have your project abc
and fire following command
php artisan serve
Now you can access it in browser by going to http://localhost:8000
hope you get it
I just want to add to the answer of Mubin Khalid . You can choose your own port number like
php artisan serve --port=8080
This is helpful when running two or more project.
You can also serve with you ip address
php artisan serve --host=ip_of_computer_running_laravel --port=8080
works to access server with in same network.
if you are accessing from same laptop you can just browse to ip_of_computer_running_laravel:8080 but if you are browsing from other computer in the network ip_of_computer_running_laravel:8080

Run Laravel on existing Apache server

I have a DigitalOcean server running Ubuntu 14.04. I'm using this as a host for my web-development projects.
Now I want to start using Laravel for a project of mine, but I have a question about this.
In the /var/www/html folder of Ubuntu I created a folder, let's say, "project". In this folder I installed Laravel using this tutorial. Now everything is setup I want to run Laravel so I can test it and start developing on it.
When I run the command php artisan serve from within the "project"-folder it says "running on http://localhost:8000". So it's working.
But how do I access it? When I go to http://example.com/project it just shows me the files in that folder.
So it's running on the localhost on my server. Does that mean that it is external-accesible (the url above) or how does this work? (I guess the port is also different, 8000 instead of the default 80 for Apache)
I hope the question is clear and someone can help me out.
I have a Laravel project up and running on Digital Ocean with the Ubuntu 14.04 x64 vmlinuz-3.13.0-24-generic (1221) kernal.
I don't think you should be using php artisan serve for this purpose, as that is more for your local computer if you would like to preview your webpage if you don't want to use Apache.
To get set up, I used the excellent below instructions that were incredibly helpful. As you can see, there are many steps that you should carefully follow to get things up and running.
https://github.com/susanBuck/dwa15-fall2016-notes/blob/master/01_Servers_and_Git/07_Deploy_to_Digital_Ocean.md
Let me know if that helps you, and feel free to follow up with more questions if you get stuck on a step.

Categories