I have project on localhost and I Need someone can help me to deploy lumen framework to hosting, i have been search in google for deploy lumen but i just found deploy laravel, maybe laravel and lumen is the same framework but i don't know how to deploy the lumen framework to my shared hosting in subdomain.
I have be been upload to :
/home/usernamecpanel/lumen
and public folder i put to my subdomain like
/home/usernamecpanel/public_html/subdomain/index.php
/home/usernamecpanel/public_html/subdomain/.htaccess
but i just got error 500.
oh, before i run i have been edit index.php to directing to lumenproject :
$app = require __DIR__.'/../../lumen/bootstrap/app.php';
I really confuse and i have been search in few day but cannot found the solution, i think someone can help me.
thank you.
Thanks for reviewing my edit
How to Fix it?
Zipping your Lumen Project
Go to your shared hosting file manager
I assume your shared hosting file manager have this directory structure like /home/username/public_html.
Create a folder outside public_html or htdocs, the folder name is up to you, example "myfolder" the structure looks like /home/username/myfolder
Upload your project to the new folder you have been created and unzip.
After unzip, inside the "myfolder" there is a folder named "public", move the contents inside to
For Main Domain
/home/username/public_html
For Subdomain or Subfolder
/home/username/public_html/sub
After moving those files, edit the index.php inside /home/username/public_html or /home/username/public_html/sub
Inside the file you see this code
$app = require __DIR__.'/../bootstrap/app.php';
change the code to
For Main Domain
$app = require __DIR__.'/../myfolder/bootstrap/app.php';
For Sub Domain/Subfolder
$app = require __DIR__.'/../../myfolder/bootstrap/app.php';
Don't forget to edit the APP_URL in .env file inside "myfolder"
Example the APP_URL .env file
APP_URL=http://yourdomain.com or http://sub.yourdomain.com or http://yourdomain.com/sub
I not got any answer from stackoverflow, and doesn't one onswer my question in stackoverflow, so i try hard find own solution with manual upload my lumen application in my shared hosting.
just put your lumen application in outside public_html and put your index.php file to subdomain and edit index.php set route to your subdomain.
if anyone have problem like me and read this question, you can ask from this question, i will help you if i got notice from this page.
You will need to move it with FileZilla to a subfolder inside /var/www/html/foldername and set configuration to the directory, but I wouldn't recommend you to set up a Micro Service in Shared host.
Related
Hi I have my website which its my resume and now I want to show the project that I have done one of my project is laravel and I move it to: public_html/laravel
and also move my DB to there but I get this error:
403 Forbidden
You don't have permission to access /laravel/ on this server.
I don't understand is it because of I didn't put files on main public_html and move it to folder or other stuff I also changes(i don't know if its right) change config/database.php mysql part to database configuration but I keep getting this error
Laravel server files from the public/ directory. So try a URL like this instead:
http://example.com/laravel/public
If that works, you'll need to move some files around a bit. This should help with moving things around:
How to change public folder to public_html in laravel 5
If you use shared hosting then please do not uplaod whole laravel application to the publitc_html folder. You have to upload your all application at global document root for your domain like home/yourdomainand you have to rename existing public_html folder to any name and rename laravel public folder to public_html and try again. See the image below:
I'm trying to remove the public/index from laravel url, since this is one of the common question so there are lot of tutorials and answer. I also searched about this and followed the #rimon.ekjon answer which is working fine for me it's pretty simple.
Rename the server.php in the your Laravel root folder to index.php and copy the .htaccess file from /public directory to your Laravel root folder. -- Thats it !! :)
I'm confuse why i should rename or move something from one place to another because there will be a reason why files exist in public folder. I want to show another good answer which is also following the almost same pattern.
I'm thinking that by following above answers' step may be create some issues in future if there will be a new requirement or new feature request in the project.
So can anyone guide me is there any best to rewrite or remove the public/index from laravel 5. I would like to appreciate if someone guide me.
You should configure your web server's document / web root to be the public directory. That way you don't have to copy/move/delete anything.
For apache you can look here.
For nginx you can read here.
I've visited your link and saw really terrible advices.
You do no need to move any Laravel files or modify them. What you need is to setup web server. You need to point it to a public directory which is inside Laravel project root folder.
Please look here for an example config directives for Apache and nginx.
One other option is to symlink the public folder to your server's root folder (e.g. /var/www/). This article is a great guide on how to do this.
On your dev environment however you can use php artisan serve.
In case, if you don't have access to you server config, this is a perfect solution https://stackoverflow.com/a/32580688/5015089 .
Remove public from url without htaccess. It will work on laravel latest versions also.
step 1. Copy all files from public and paste on root directory
step 2. Open index.php file remove ../ from path as given below
Laravel5:
require __DIR__.'/../bootstrap/autoload.php';
to
require __DIR__.'/bootstrap/autoload.php';
and
require_once __DIR__.'/../bootstrap/app.php';
to
$app = require_once __DIR__.'/bootstrap/app.php';
Laravel 7:
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
please guide me how to upload the Laravel project to my cPanel I am very much confused.
you should add all the folders of laravel inside of public_html folder, and you need to move index.php and .htaccess file to the public_html directory from public directory. Now make changes index.php like this.
require DIR.'/bootstrap/autoload.php';
$app = require_once DIR.'/bootstrap/start.php';
That may work for you.
If you check your laravel project, there is a public folder inside it.
By default, your domain is pointed at the root level or on public_html. On you cPanel Domain settings, make sure your domain is pointed your Laravel application public folder.
I have a problem when upload laravel project on my shared hosting. On that hosting I have two addon domains with separate folders in document root. But when I put laravel project in document root and move everything from public folder in root to remove that "/public" from url, I cant access to my addon domains. I'm getting 500 Internal service error. When I remove .htaccess file I can access to my other domains, but I can't access to my Laravel project. How can I change default laravel .htaccess file?
Well, you should not move everything from public folder, this is a very important part of your Laravel application, it was built this way to separate your application source code from the public files anyone can access, if you make your application root also your public folder, anyone will be able to access any php files from your application, and this is so unsafe...
What you need to do is to point your document root to /serverRoot/applicationRoot/public.
If you really cannot do that, I'm afraid you'll have to edit index.php and try to change thos two lines:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
to
require __DIR__.'/bootstrap/autoload.php';
$app = require_once __DIR__.'/bootstrap/start.php';
And see if it works for you.
EDIT
Laravel's default .htaccess file is there just for rewriting your URLs, so you dont see aindex.php` on them. Basically it does 2 things:
1) If you access your site using http://www.site.com/, internally it will point to http://www.site.com/index.php.
2) When you access your site using http://www.site.com/index.php it hides the index.php part.
This is kind of recursive, because the first step leads to the second one.
Now you have to think and see how this is conflicting with your other domains, because the files you are serving in those domains matters and since we are not aware of what they are, helping more is kind of difficult.
If you setup your document root as C:\xampp\htdocs\ and you create a project folder named "ProjectX" where you include all your project files and folders and subfolders, how are you going to make your project runnable with url "http://localhost/projectx" ? I would like to learn how your config and routes files you included in your projects are changed ?
you can refer below link
http://book.cakephp.org/1.3/en/view/912/Installation
cheers
I would not run them as "localhost".
If you link css/js/img absolute to the / root, you will run into problems later on your life server.
it is always best to use virtual hosts and simulate the "real life" on your system:
http://www.dereuromark.de/2011/05/29/working-with-domains-locally/
You can create a folder projectx in C:\xampp\htdocs\
Then copy all the CakePHP files in C:\xampp\htdocs\projectx\ (including .htaccess, app\, lib\ and all. Setup the salt, cypher, db files and you should be able to access it through http://localhost/projectx/