I am using a shared host. Inside my shared host public_html, I have a folder named project1. This folder contains the files for my main site.
I want to create a new folder (e.g. Project2) for my new Laravel 8 application. I've tried putting all my file inside public_html. It is working when I visit the site using the example.com/project2/public/index.php URL format. But the problem with this is that my important file like the .env, will be public.
I've also tried this but when I tried to run the project, it gave me a 500 error.
Try changing the name of server.php file to index.php and copy .htaccess file from public folder to same location where server.php
Related
I've already deployed a laravel project to the server with CPanel. I've transferred all the public files in websiteA to the public_html. It works fine. The directory looks like this.
/home/tuturu
->public_html
->websiteA
->app
->vendor
-> ...
Now I'm trying to add an addon domain websiteB to the same server. As its a laravel project and want it to be pointing at the public folder, I've seen the root document to be public_html/websiteB/public. Now, the directory looks like this:
/home/tuturu
->public_html
->websiteB
->app
->vendor
->public
->websiteA
->app
->vendor
-> ...
I've also changed the index.php inside the public folder to:
require __DIR__.'/../public_html/websiteB/vendor/autoload.php';
$app = require_once __DIR__.'/../public_html/websiteB/bootstrap/app.php';
but when I go to websiteB, it gives an HTTP 500 error. Thanks in advance.
Create a folder in your home directory for example my_websites:
Upload two of your sites to this folder:
Configure your "Add-On Domains" to point to Laravel's public folder for each site:
Keep in mind that paths are case sensitive on Linux systems.
I zipped all my files before uploading it to elastic beanstalk. However I'm getting an error message:
Not Found
The requested URL /was not found on this server.
I did some research and came across the following post:
https://forums.aws.amazon.com/thread.jspa?threadID=127927
"The '403 Forbidden' error was because of the file structure of the zip folder. In order to upload properly please highlight/select all the contents "inside" the folder then you can compress/zip the contents and not the folder itself. That is, you cannot have a nested folder inside the zip."
I have done as told, except that I have selected the files AND 2 folders which contain some files. This may be causing the issue(?)
What should I do?
As you have mentioned that you are facing “The requested URL /was not found on this server”, you need to ensure the following:
1: Make sure your application has the file that .htaccess is
redirecting to your welcome page. 2: You need to set the public
folder as the root folder. For this, go to the Elastic Beanstalk
Console and Click on “Configurations”, then modify Software . Update
the “Document root” to the folder that contains your site's
default page. For example /public if the welcome page is in a folder
named public.
this is my web server directory
Data folder contains all project code
and public folder data resides in public_html/alpha
like this
my index.php file which is in public_html/aplha
require __DIR__.'/../../data/bootstrap/autoload.php';
$app = require_once __DIR__.'/../../data/bootstrap/app.php';
and finally my server.php file
require_once __DIR__.'../public_html/alpha/index.php';
i have also given all permissions to public files but still getting Inter Server Error
i am trying to make domain.com/alpha home directory
and route '/' will be called like domain.com/alpha/
I don't see a Laravel project inside your /alpha
Their are some simple steps for run projetc on server..
First Project will upload in /public_html or (/public_html/Project_name)
Check Your php version.. Because its only compatible with php 5 or above
Rewrite module must be enabled on server.
Rmaining part must be same as like your local project then run it on the domain.
I've seen many people posting here on how to remove the /public folder from URL.
E.g. http://some-domain.com/LaravelProject/public/index.php
It's simple. Suppose your Laravel project is in LaravelProject directory. Copy the server.php in the same folder as index.php.
After that, copy the .htaccess file from public folder in LaravelProject, i.e. your Laravel root folder. It should work!
I have a CakePHP project uploaded to the server:
httpdocs/cakephp/app/...
My domain name, for example www.mydomain.com is directed to httpdocs/cakephp
Now.. I need to access an image folder that it's otside the webroot of CakePhp:
httpdocs/resources/images/...
The problem is that I can't see files outside the cakephp folder when I go to www.mydomain.com, If I try with ../../resources/images.... I just get www.mydomain.com/resoures/images with an error.
How can I solve this?
Thank you!
Just symlink the resouces folder in your webroot folder.
Alternatively you can send the files through php. The CakePHP book describes this here for >2.3 and here.
Also it is not a good idea to put the whole cake folder in the root of your domain, you should set your app/webroot has the root of your host.