Pointing apache DocumentRoot to Laravel gives 403 Forbidden error - laravel

I wanted to host my laravel project on google CentOS 7 server. Following the instructions I have install the laravel project and have changed /etc/httpd/conf/httpd.conf files changing DocumentRoot to /var/www/html/laravel/public and <Directory /var/www/html/laravel. Now when I open my website Forbidden You don't have permission to access / on this server.. However, when I proceed to mysite.com/laravel/public my website loads perfectly, meaning that I'm in www folder even if I have changed the DocumentRoot. httpd -S points to my laravel public folder - Main DocumentRoot: "/var/www/html/unionbox.pro/public". When I change DocumentRoots back to /var/www/html my website just list files and folder in the www directory when I open my website. I would appreciate your help! (have been trying to resolve it for 2 days)

Related

LaraDock multiproject laravel 8 - installation issue

I am completely new to LaraDock. After hours of trying to dockerize existing Laravel 8 projects, I discovered LaraDock. I have installed it successfuly and the container is running in Docker. When I go to localhost, however I get 404 not found. I need help to correctly set up the web server conf files.
So far I have created a new .conf file in apache2/sites as well as nginx/sites (as I do not know which webserver is running on Mac Monterey with LaraDock).
So in apache2/sites the new project1.conf has the following lines:
ServerName project1.test
DocumentRoot /Users/paul/Sites/project1
And in nginx/sites the project1.conf:
server_name project1.test;
root /Users/paul/Sites/project1;
index index.php index.html index.htm;
In the browser project1.test also returns error 404 not found.
In several .conf files the normal path to apache hosted file (/var/www/) does not exist on Monterey. Should I replace these instances by /Users/paul/Sites/ ?
What am I missing?
in laravel the document root should be /public on the end.
so it could be
/Users/paul/Sites/MeerkatSafaris/public
and / or
DocumentRoot /Users/paul/Sites/project1/public
but it is unclear which is the correct root in your question

Codeigniter 4.0.4 redirecting to 404 - File Not Found

Why I got 404 - File Not Found when I run CI.
I am using xampp 8.0.0, I already put my CI folder to htdocs and also I've changed the config/app baseurl to http://localhost/framework-4.0.4/.
When I open it to browswer and click public it just redirected to 404.
enter image description here
You should setup a virtual host in your xampp for your project.
To do that for this codeigniter projects, open the the Apache httpd-vhosts.conf file which are located in C:\xampp\apache\conf\extra\httpd-vhosts.conf, Added below lines of code at the end of the file.
using the example codeigniter-blog.local
DocumentRoot "C:/xampp/htdocs/framework-4.0.4/public"
ServerName codeigniter-blog.local
Now, Open the hosts file which are located at C:\Windows\System32\drivers\etc\hosts, Added below code into this file at the end.
127.0.0.1 codeigniter-blog.local
restart the xampp server.
If you open the browser and navigate http://codeigniter-blog.local, if you are getting welcome page, that means everything fine otherwise you'll get intl package is not enabled.

Deploying Laravel 5 to Server Issues

So I have been following a tutorial on how to do this.
I zipped everything but my public folder.
uploaded and then unzipped files in the folder before the /www folder.
Uploaded the .env file separately since no hidden file got uploaded.
put public folder into my subdomain folder. I editted the index.php appropriately to go to the right directory.
Now I am getting a blank page on the site. Into my SSH I see the files including artisan but when I do php artisan nothing happens. Even when I do php artisan tinker nothing happens.
I'm not sure what is going on... What is wrong?
Laravel public folder serves the content of your website. the entire framework and vendor directory are behind this path. so public users cannot access all those folders its primary security for the framework.
It means on server you don't upload the entire framework to public_html folder and don't point the domain to public folder of laravel without setting proper symlink.
This point can be done with symlink creation in servers. for example you can edit the host file in Linux/Windows and set the project domain. something like homestead.app. Then in your apache configuration simply set this project domain to its physical path. like below.
<VirtualHost *:80>
ServerName homestead.app
DocumentRoot /home/User/Development/homestead/public
<Directory />
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
</VirtualHost>
So you can access the project in browser like homestead.app for more details check this link.
Hope its clear now.
I recommend putting all of your code together then creating a sym link to your public folder in your subdomain folder.

XAMPP Symbolic link Access Forbidden

For a xampp server I have created a symbolic link.
Now when running the server I get an error:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.7 (Unix) OpenSSL/1.0.1e PHP/5.5.6 mod_perl/2.0.8-dev Perl/v5.16.3
In the project directory I currently only have an index.html file containing:
<!DOCTYPE html>
<html>
<body>
<p>test</p>
</body>
</html>
I have checked all the permissions on both the project directory and the directory the symbolic link is located in.
These are all set to 777.
What could I do to get this to work?
What you have to do is create virtual host in apache configuration.
I would recommend using pure apache without xampp on most unix based systems, but with xampp it's still possible.
Find your apache config directory and head to extra folder, it should be organised with something like: \xampp\apache\conf\extra\
Add listener and virtual host on the bottom of the file like that
ServerName localhost
Listen 8080
<VirtualHost *:8080>
DocumentRoot "diretory/with/index/"
<Directory "directory/with/all/files">
Require all granted
AllowOverride All
</Directory>
</VirtualHost>
The main difference between DocumentRoot and Directory is that DocumentRoot must point directly to the place where you index.php is located.
Directory is just poinitng to the all resources places.
For example you can have stuff/public folder in which are located all things that user can access, but also you have some frameworks like laravel which is upper in directory and still needs to be maintained by php interpreter, but shouldn't be accessible directly to the end user

Error getting images to show up in Symfony 1.4.8

Note: It was tough deciding whether this belonged here or ServerFault, but it seemed like a programming problem, so if it's out of place, feel free to migrate it.
I downloaded the sandbox of Symfony 1.4.8 and copied the files to my webserver. Unfortunately, when I try to access /symfony/sf_sandbox/web/ (where I installed it), I get the following:
It seems like the images aren't showing. According to the text:
If you see no image in this page, you may need to configure your web server so that it gains access to the symfony_data/web/sf/ directory.
However, when I try to locate the folder referenced above, it does not exist:
sf_sandbox
web
css/
images/
js/
uploads/
frontend_dev.php
index.php
robots.txt
As you can see, there is no sf/ directory under web/. What am I doing wrong?
Note: I am installing this on Ubuntu 10.04 64-bit using Apache.
All the images are located in the Symfony source directory.
I would try creating a symbolic link in the web folder called sf pointed to the following:
lib\vendor\symfony\data\web\sf
It should have access to the needed images at that point.
This is done by indicating the right path in the Alias directive in your apache configuration:
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080
# This is the configuration for your project
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
DocumentRoot "/home/sfprojects/jobeet/web"
DirectoryIndex index.php
<Directory "/home/sfprojects/jobeet/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
<Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Just replace "/home/sfprojects/jobeet" with your project's path and it should work.
This page shows the apache config to set up a new project correctly.
There are also important security notes for your webapp.
Symfony Documentation
All you need to do is copy the whole sf folder to the web folder. In my case i copied c:\wamp\www\jobeet\lib\vendor\symfony\data\web\sf\ to c:\wamp\www\jobeet\web. Hope that makes sense

Resources