Laravel 5.5 How to access website insted of /public folder - laravel

I have setup laravel 5.5 on my localhost and want to
access the project directly instead of /public directory.
My Current link is: http://localhost/my_laravel/public/
I Want to access as: http://localhost/my_laravel/

start a server using
php artisan serve
in cmd/console go to the project directory and run the above cmd.
it will run your app on http://localhost:8000

Related

How To Upload Laravel with vuejs To Shared Hosting

I upload my laravel project in Host domain i work with laravel and vuejs, any easy way to deploy it?
Just follow the following steps to deploy your Laravel and vue.js application to a shared hosting.
generate your product vue build using npm run prod
upload all the changes and project to a git repository.
clone your git repository to your shared hosting, mainly via integrated terminal in some shared hosting or via ssh key access.
redirect your domain or subdomain directory to /public folder.
run composer install
run cp .env.example .env
setup .env files according to database configuration and emails etc.
run php artisan migrate
run php artisan key:generate
run php artisan storage:link if you want media uploading to your server.

how to Deploy VueJS, laravel App on live server

i want to deploy the App of laravel with inbuilt vuejs
on my local i just run the "PHP ARTISAN SERVE"
and boom its works for me
but what about the live ?
its not working on live server
my .htaccess and index.php is in public folder
for Laravel we just move the index.php and .htaccess out of public folder and edit some code lines and it will work.
but how it will work with vuejs templates ?
Follow these steps:
Please create a zip folder of your project except the vendor folder.
Deploy the folder on live and extract.
Change your DB and other configuration in env file.
In the terminal on live server, run this command : composer update
After the installation, look for your front page.
Hope it should work fine.

How to remove "public/index.php" on server?

I m newly working on laravel.
I created laravel project named as "blog" on localhost and for removing public/index.php, I followed following process :
cut and pasted .htaccess from public/ folder to root i.e. blog
Renamed the server.php to index.php
Then I created a test api in api.php route and echoed "Hello World".
Now when I go to project path from my localhost server like:
localhost/Blog/api/test then its work properly.
But when I run same on a server like 192.101.111.555,like :
192.101.111.555/Blog/api/test then it showing NOT FOUND.
I am not getting how can I resolve this. And why its working fine on localhost but not working on server ?
You rename server.php but not recommend. This file copy then rename
Yes, if you have done those settings you will not be able to properly access on the localhost by running php artisan serve. So for this, you can install xampp and do the virtual host settings. Check more info at
How to enable Virtual Host on Xampp for Laravel?.
On the benefit of this is that you don't have to run the php artisan serve command again and again.

Xampp localhost not working

I am running laravel on xampp and I have problem with accessing pages,
http://localhost/laravel/public/ I get a login page which is good
however when I go for example http://localhost/laravel/public/smokeyard
I get 404 error with The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
Route:
Route::get('smokeyard', 'GuzzleController#smokeyard');
Controller:
function smokeyard(){
return view('smokeyard');
}
All my views are located in resources folder.
if you want to access laravel project without running artisan serve, you need to change few settings,
copy the .htaccess file from the public folder and paste it in the root folder of your application
rename the server.php in the root directory to index.php
now go to localhost/your_project_name/smokeyard for the url you want to check
hope this helps
Run php artisan serve and access your server at http://localhost:8000. Your routes should work fine then.
You can't access your laravel application routes straight away through the folder structure with xampp. You need to setup the web root to point to the public folder and access localhost or run the laravel server and use it. This is because the url rewriting would fail when you access the routes in laravel the way you do.
I tried this in MX Linux 21.xx. My xampp got messed up after installing larvel on it.
check MySQL status with command
mysql service status
stop the service using the command
service mysql stop
you will be prompted to provide your password, Enter password.
start xampp using command
sudo /opt/lampp/lampp start
All should be back to normal

Lumen not working out of the box

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.

Resources