How to upload correctly addon domain with CPanel - php

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.

Related

Migrate Laravel 8 to a subfolder of a shared host

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

How to allow access to sub folders in laravel?

I have laravel installed on my server and I want to add a folder called 'projects' in laravel's root folder and access the projects folder from URL.
What should I do to solve this issue? I want to upload some PHP code demos and allow people to view them.
I have tried playing with the .htaccess but nothing seems to work for me.
public_path(); // Path of public/
base_path(); // Path of application root
app_path(); // Path of app/

laravel 5.2 project not working on webserver

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.

Laravel 4: prevent access to any file or folder except public

I'm working on small project, and will host it on normal Godaddy host plan, the problem is: all file system will be accessible through internet.
so, how can I prevent access to any folder or file except /public
CONTRIBUTING.md
app/
artisan
bootstrap/
composer.json
composer.lock
phpunit.xml
public/
server.php
vendor/
thanks,
Why not split the project up? Upload the contents of public to your document root and the rest somewhere else (like your home directory). Then just modify the two paths in the public/index.php file to point to the right locations, eg
$path = __DIR__ . '/../my-app';
require $path . '/bootstrap/autoload.php';
$app = require_once $path . '/bootstrap/start.php';
If you point your apache site document root to /public, there is no way people can access any other file in your application outside your public. Even if they try to do things like:
http://yoursite.com/../
EDIT:
This is not something you should rely on a framework to do, securing directories on your site is the web server job, so you need to find a solution on your server: virtual host, document root, web root, domain directory or even .htaccess configuration.
In some shared hosting companies you can do that easily, some have cPanel or Plesk, but other, like Hostgator, will give you just enough configuration so you can change your directory root to /public. Looks like GoDaddy doesn't help much if you don't have a cPanel account, but, still, there are tricks to help you doing it the way you should be doing: http://support.godaddy.com/help/article/4067/setting-up-a-non-web-accessible-root-folder. Probably there are others around.

Access content outside CakePhp folder

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.

Categories