Apache - forbidden 403 error - when different document root - apache

I've been having this issue for a while now. Never got to fixing it. Basically whenever I have a DocumentRoot which is not in
/var/www
I get a
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at example.com Port 80
My VirtualHost looks like this
<VirtualHost *:80>
ServerName example.com
DocumentRoot /home/prakash/1985/Foodini/bitbucket/foowork/views
</VirtualHost>
What could the reasons be ? Should I have the files belonging to a different group or have different permissions ?

Related

Laravel Virtual host doesnt work

Iam trying to make virtual host for laravel 5.2 in apache server, but everytime i tried to access the virtual host it always shows "This site cant be reached", but i can access it through localhost:folder/public
I already setting the httpd-vhost
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/belajarlaravel/public"
ServerName belajarlaravel.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp2/htdocs/merchandise3-project/public"
ServerName merchandise.dev
</VirtualHost>
and my host
127.0.0.1 localhost
127.0.0.1 belajarlaravel.dev
127.0.0.1 merchandise.dev
I can access the localhost but for other host they still showing server not found and site cannot be reached. Can u give me some advice ? Thank You for your attention.
maybe the .dev ending is considered unsafe by Chrome, try .com

Apache 2.2 - You don't have permission to access site on this server

Hello I am using Server version: Apache/2.2.22 running Ubuntu 12.04.5 . I had my website on another server which was running correctly with 750 permissions to whole folder. When I moved to the new server :
I created the virtual host and I turned it on (a2ensite, reload and restart apache)
<VirtualHost *:80>
ServerAdmin webmaster#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /path/to/project/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I set permissions of the project folder to 750 and I get the error :
(13)Permission denied: /path/to/project/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
I cleared .htaccess file but I got the same error. SELinux is not installed and my httpd.conf file is empty. Any ideas?

Unsure of what to add to hosts file - Apache Subdomain

I'm trying to make a subdomain for my xampp/apache hosted website.
However, whenever I attempt to access the subdomain it gives me an "HTTPS insecure error" and redirects me to the main part of the site. Also, I can still access the main site without any issues at all.
In my 'httpd-vhosts.conf' file, I believe all the entries are correct and the issue lies with my hosts file.
To clarify, this is a website with a premium domain name, (i.e not just a website for local use). Most of the tutorials and guides I can find are only really designed for websites that are used locally only.
Here is my 'httpd-vhosts.conf' file (with my domain name edited out of course):
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName domain.xyz
ServerAlias https://domain.xyz
ErrorLog "logs/domain.xyz-error.log"
CustomLog "logs/domain.xyz-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/sub1"
ServerName sub1.domain.xyz
ServerAlias https://sub1.domain.xyz
ErrorLog "logs/sub1.domain.xyz-error.log"
CustomLog "logs/sub1.domain.xyz-access.log" common
</VirtualHost>
The entries I have in my hosts file are (which I'm fairly certain is completely wrong):
127.0.0.1 localhost
127.0.0.1 domain.xyz
127.0.0.1 sub1.domain.xyz

Change Document root of LAMP folder

I need to change the document root to something else.
for example I want my root as ~/Dropbox/www instead of /var/www/html
To achieve that I've changed my /etc/apache/sites-availabl/000-default.conf file
to
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster#localhost
DocumentRoot ../../home/ahmar/Dropbox/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
when I restart the server it seems fine
But When I open my localhost
it gives me a forbidden error
with this message
Forbidden
You don't have permission to access / on this server.
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
Try Putting
"DocumentRoot /home/ahmar/Dropbox/www/"
It should fix the problem. :)

XAMPP + virtual hosts + group shared folder

I have folder which mount for all users which in group 'common' for sharing files
/home/.common/ mounted to /home/common by fstab
bindfs#/home/.common /home/common fuse group=common,perms=g=rwx
I want to share sites folders too. I put sites to dir /home/common/Sites/
and made virtual host to those directories. But i'm having error on enter.
on http://mysite/
Access forbidden!
You don't have permission to access
the requested directory. There is
either no index document or the
directory is read-protected.
If you think this is a server error,
please contact the webmaster.
Error 403
in httpd.conf
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
in httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/common/Sites/mysite
ServerName mysite
ErrorLog /home/common/Sites/mysite/mysite.local-error_log
CustomLog /home/common/Sites/mysite/mysite.local-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /home/common/Sites/mysecondsite
ServerName mysecondsite
ErrorLog /home/common/Sites/mysecondsite/mysecondsite.local-error_log
CustomLog /home/common/Sites/mysecondsite/mysecondsite.local-access_log common
</VirtualHost>
in .local-error_log
[error] [client 127.0.0.1] (13)Access denied: access to / denied
When i turn on vhosts - localhost returns error too. If turn off LH works good.
How to make this structure?
The problen was in permissions. I was need to change apache user and group in opt/lampp/etc/httpd.conf