Install Laravel on dedicated server's subfolder - laravel

So I am having an issue with pushing a Laravel app to production on a dedicated server's subfolder.
Server is run on Apache.
Url I want to push my app would be subdomain.domain.com/project
The structure of my dedicated server is
.cpanel
...
-laravel
-app
-vendor
-...
-public_ftp
-public_html
-folder
-contents of laravels public directory
-ssl
I know that in order not to expose my hidden files I am required to install it in a root directory, but this is not an option because I will be having multiple projects running under subdomain.domain.com/project-1, subdomain.domain.com/project-2 and etc... and all will have a separate laravel installation.
I need a hand in order to achieve that, can anyone give me some advice?

Managed to do it myself, the problem was when i was creating a symlink, so instead i just moved contents of my public directory to public_html/project-1/ and changed index.php path to /../../laravel/
The thing was that I have done it originally but I didnt expect that permissions for storage need to be manually set, that solved my issue and laravel works.
ALWAYS CHECK ERROR LOGS :)

You can place your separate folders in your subdomain with no problem.
The important thing is that you need to point the browser to public/ folder under your laravel projects.
You can create a .htaccess file with the command below in root folder of each project and perform a redirect.
Place the following command in your .htaccess file:
RedirectMatch ^/$ /public/

Related

How to deploy Laravel 5.5 on shared hosting without composer

I am trying to deploy a Laravel project on shared hosting. I copied the Laravel folder in user's root directory (/home/shrpr) and copied the content of public directory in /home/shrpr/www folder. I modified the index.php in public folder to include "../Laravel" as explained in site. Since, composer is not allowed on this shared hosting, I also copied my local vendor and storage folder along with laravel folder. But I still keep on getting error 500. So, I added a test.php file in the laravel folder and included it in index.php file to test if path and all is correct as under:
require __DIR__.'/../laravel/test.php'; die;
This works fine as the content of test.php is getting displayed properly. So, it looks like some dependencies of vendor folder is missing. Is there a way of identifying and uploading complete dependencies of laravel and uploading it, that is without use of composer?
Try composer update before upload to shared hosting.
Change permissons of your index.php to 644.
Check your enviroment, maybe isn't works.
Wich version of php is running in your shared hosting? and wich is yor Laravel version, change php version to 7.0
Make sure you have PHP 5.5+ installed on the server. Move the index.php file from public to www and change the paths accordingly.
Another way to deploy laravel on shared hosting is to set up your domain as addon domain and then set root folder of the addon domain to the /public folder of the laravel project. eg. home/mili/laravelproject/public
I tried this with godaddy and it worked.

Laravel 4.2 in FTP server throwing Error 500

I've searched everywhere for a solution. Plus, I tried tracking the error using echo("teste");, but can't find exactly what is wrong, since it works on my local host.
From index.php -> bootstrap/autoload.php -> vender/autoload.php:
I could print a msg until before the foreach in getLoader method of ComposerAutoloaderInitxxxxxx class.
I see it can't complete the require in both bootstrap/autoload.php or bootstrap/start.php
my directories levels are:
public_html/
|__laravel/
|__app/
|__bootstrap/
|__vender/
|__index.php
|__artisan
|__robots.txt
I've changed the paths correctly when moved the files from public/ to laravel root, since I can get into the files required (it just can't finish loading).
I get
500 (Internal Server Error)
Ps.: I uploaded the project through Filezilla, and I only have the FTP access.
Please, could someone help me with this?
Ok first you should not upload a Laravel project via FTP, if you only have an FTP access then you need a real hosting provider that has SSH. You should be able to use the composer command on your production server or you will be in big trouble later :)
Also, assuming this is a cPanel host (based on the public_html folder) the proper way would be to git clone the Laravel project under a folder, remove the public_html folder and create a symbolic link like this.
ln -s ~/laravel/public ~/public_html
This way your document root will point to Laravel's public folder.
Here is more information:
https://laracasts.com/discuss/channels/general-discussion/how-to-install-laravel-in-the-root-directory

Make symlink laravel public folder

i've tried push my laravel 5.1 project to server. I want to make a symlink to public_html folder so i can access it like normal.
ln -sv app/crowd/public public_html
i've tried that one. but the symlink is taking the public folder instead of it's content.
ln -sv ~/app/crowd/public ~/public_html
i've tried that one too but it still fail.
any suggestion how to make it works?
If "the symlink is taking the public folder instead of it's content" means that your browser is giving a 403 or saying you can't access the folder, it may mean that you don't have index.php in your DirectoryIndex directive (if you're using Apache - not sure what the equivalent is on nginx).
When you enter a location in your browser and don't include a filename (www.host.com/page.html), the server looks at a list of default pages and sees if one of those is present. If not, it tries to serve the whole directory. Try browsing to www.host.com/index.php and see what you get. If it loads, you just need to update your config. If not, please explain what you see.

How to run laravel 5.0 project on localhost without use php artisan serve

I have created a laravel 5.0 project with php artisan serve, now i need to know how to run laravel 5.0 project run without start php artisan serve, i have already browse lot of websites no one help me..
You need to change "server.php" to "index.php" then copy ".htaccess" from public to root directory.
See: https://stackoverflow.com/a/30053989/3948755
Laravel sever Folder is "public". There is an index.php so you can run you project from there.
Suppose if you using UbuntuOS then you have to create your local server in public directory. Suppose your folder name is laravel_test then go in that directory and run some thing like this
php -S localhost:8000 -t public
If you using windows then access public folder from URL.
localhost/laravel/public
Actually it's bad practise to access folder from URL but for local its good. You also can go with host entry. Just make sure that your target folder is "public" directory.
Normally you would have WAMP/XAMPP installed. You can access Laravel project like below
localhost/laravel/public
But this is not recommended. You should create Virtual host for example
laravel.local that pints to server-root/laravel/public.
this is how you create virtual host.
Or even better go for a Laravel Homestead .
How is your .htaccess file configured?
Try with localhost/laravel/public/index.php
Use http://localhost/projectName/public
It will be work. but in case if you have another Route and you can not access that Route and get the error like " Page Not Found " then please use the following command
sudo a2enmod rewrite
Now open the http://localhost/projectName/public/yourRoute
This is a little late but still applicable, what I like to do (using ubuntu 14.x+) is put my laravel project (let's say Project1) in my var directory, so it would be in /var/Project1, then symlink the public folder to somewhere in /var/www(+/html depending on apache version).
Symlink can be done something like this:
ln -s /var/Project1/public /var/www/html
This keeps your internal files off the grid so to speak, this is untested so if I've missed anything just comment and I will amend this post.
EDIT:
Obviously if your http root is /var/www/html you can put your project in /var/www/Project1
If you have access to xampp or wampp on your operating system you can more or less configure your virtual host like in the instruction below:
https://bestin-it.com/creating-virtualhost-on-your-local-computer-to-start-simple-index-php/
This instruction shows how to run it locally on your PC, but it works generally the same on any hosting portals. In most case in payed portals you have any web panels to configure your public folder that reference to /public folder in laravel folder's structure.

Index page is not coming / showing in laravel framework

I am using Ubuntu 14.04LTS. Here is what i have done till now:
I have installed composer using curl,
move this composer.phar file to usr/local/bin directory
Created project laravel in my root folder i.e. var/www/html
Change the permission of app/storage folder.
Created the file name as laravel.conf like 000-default.conf in etc/apache2/site-avaliable directory.
edit that laravel.conf file from terminal and save that file.
disable 000-default.conf file and enable laravel.conf file.
restarted the apache2 service.
Here is my problem: now i am trying to run it from my localhost but it does not show index.php page of my project laravel.
Any help to sort this, will be highly appreciated.
Laravel builds its own output based on your controllers, generally utilizing view files (blades) as templates. Unless you specifically tell it to in your controller, it will not return a static or dynamic index.php page. If this is your first Laravel project, I recommend reading up on how routing works at http://laravel.com/docs/5.0/routing .

Resources