Apache: 403 Forbidden when activate virtual host - apache

i have an absurd problem with apache and CentOS, the webserver work in default mode, when go to http://myip i view correctly the apache test page. If add `/etc/httpd/conf.d/foo.conf
<VirtualHost *:80>
ServerName foo.local
DocumentRoot "/home/foo/html"
ErrorLog /var/log/httpd/foo.local-error.log
<Directory "/home/foo/html">
Options Includes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I have 403 forbidden to ALL directory configured to apache, i do not see either the test page.
The directory /home/foo/html have owner and group apache, and permission 775 to directory and 664 to file. I see in the log:
AH00035: access to / denied (filesystem path '/home/foo/html') because search permissions are missing on a component of the path
If i deactive this conf file, apache works and see the test page

I have resolved changing the path, instead that /home/foo/html i put /var/www/foo and worked

Related

Access Forbidden when using xampp with ngrok for accessing a local vhost

I have set up a vhost that is working locally, I would like to access it from other devices using ngork. But I always get this message: "Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected." when trying to access the link provided by ngrok (although locally it works fine, and I even tried to disable my firewall altogether but the problem persisted)
My vhost:
NameVirtualHost *:80
<VirtualHost security.local:80>
ServerName security.local
ServerAlias security.local
DocumentRoot "E:\Websites\security\public"
<Directory "E:\Websites\security\public">
Order Allow,Deny
Options All
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
The ngrok command I use:
ngrok.exe http security.local
My hosts file:
127.0.0.1 security.local
I found the solution. The correct ngrok command has to be:
ngrok http -host-header=rewrite security.local

Domain alias in xampp

I'm trying to place a domain alias named noetic.dev, I'm having a fresh laravel installation in the htdocs folder named noetic.
For achieving this I tried to change httpd.conf file and added this:
Alias /noetic.dev "F:/xamp/htdocs/Noetic/public/"
<Directory "F:/xamp/htdocs/Noetic/public/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
and I changed following in httpd-vhosts.conf:
<VirtualHost *:8082>
ServerName noetic.dev
DocumentRoot c:/wamp/www/NitsEdit/public
</VirtualHost>
and similarly I've in the hosts file:
127.0.0.1 noetic.dev
Now while trying the link to be as http://localhost:8082/noetic.dev/ I'm getting the result but while trying noetic.dev:8082 I'm getting an error
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.
I don't know where I'm doing wrong, guide me in this.
For Vhost you have wrong path of C:/
DocumentRoot c:/wamp/www/NitsEdit/public
that should be
DocumentRoot F:/xamp/htdocs/Noetic/public/

Correct client denied by server configuration error after moving website to proxy

My website directory structure was this:
/var/services/web/
A portion of my website is a Wordpress page called portal with a Ninja Forms plugin. Ninja forms stores uploaded files in a directory on the server for all to see. So to deal with that I did this in the site's configuration file:
<Directory "/var/services/web/portal/wp-content/plugins/ninja-forms/">
AllowOverride None
Order deny,allow
Deny from all
</Directory>
I have had to move my website to a proxy server and now the Ninja Forms directory structure is like this:
/var/services/web/MYWEBSITE/portal/wp-content/plugins/ninja-forms/
I am not sure how to make the above Apache config item work in the proxy server. My proxy set up in httpd-ssl-vhost.conf-user is like this (port 80 is similar but I don't think that is an issue because I am only connecting ssl. Correct me if I am wrong):
<VirtualHost *:443>
ServerName www.MYWEBSITE.com
DocumentRoot "/var/services/web/MYWEBSITE"
ErrorDocument 403 "/webdefault/error.html"
ErrorDocument 404 "/webdefault/error.html"
ErrorDocument 500 "/webdefault/error.html"
SSLEngine on
</VirtualHost>
I tried just changing the path in the Apache config file to:
<Directory "/var/services/web/MYWEBSITE/portal/wp-content/plugins/ninja-forms/">
AllowOverride None
Order deny,allow
Deny from all
</Directory>
And this just produces the following error:
client denied by server configuration: /var/services/web/MYWEBSITE/portal/wp-content/plugins/ninja-forms . . . etc.
So, I think I need to add lines to my proxy ssl set up. I could use tips on the proper SSL set up in my proxy server. Other solutions I have found here appear to be changing the Deny from All line and I do not want that.

Accessing to a file and folder in Apache from Localhsot

I want to create a virtual folder with a file in it in Apache, and to see that file from my browser : how can i fix it ?
the error i get when i try my local host in browser:
You don't have permission to access / on this server.
I tried:
1) created a folder in etc/apache2/sites-available
2) checking the default Apache settings which is not blocking my IP which is 192.168.1.5:
Assuming that you are trying to serve /yourfolder. Change the permission of the folder to give access right to others (755 for example) and add following to site conf you have created.
<VirtualHost *:80>
ServerName example.com:80
DocumentRoot /yourfolder
# Change according to your folder path
<Directory /yourfolder>
Order Allow,Deny
Allow From All
Options -Indexes
</Directory>
</VirtualHost>

Virtual host showing apache test page and everything else in doc root is forbidden

I am using a new CentOS 6.3 minimal install with fresh httpd installed
When I go to my virtual host it is showing me the apache test page, and then if I go to mydomain.co.uk/index.html (That I have just set up to test with) it says forbidden. All the usual answers to this don't seem to be working and I have honestly looked through tons of forums and other people questions/answers and nothing seems to be working for me.
I have created a group called 'www' that I have added the user 'apache' to.. This is my root directory in httpd.conf file, I have left it pretty open just for testing:
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
This is my vhosts file:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/
</VirtualHost>
<VirtualHost *:80>
ServerName domain.co.uk
ServerAlias www.domain.co.uk
DocumentRoot /home/domain/public_html
<Directory "/home/domain/public_html">
Options Indexes FollowSymLinks ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
From /home/ onwards I have set the group to www
When ls -lA on home folder I get
drwxrwsr-x. 5 root www 4096 Feb 5 20:57 home
The error I am getting in my logs file is a permission one:
[Wed Feb 06 10:24:42 2013] [error] [client 62.254.7.226] (13)Permission denied: access to /index.html denied (filesystem path '/home/domain/public_html/index.html') because search permissions are missing on a component of the path
As is everything else in that folder. I really don't know what to try next. I have come to the point of needing to ask for my specific setup as following other tutorials or answers has not worked for me. Any help is greatly appreciated!
Error 13 means that the user/group specified in your apache configuration (httpd.conf) didn't have permission to access the files. The files, and all the directories above them, need to have permission that allow for that user and group.
One of the trickier bits can be extended permissions. If you are running selinux, the server user could be denied because of the extended permissions on the file. To check for this, run (from the command line):
setenforce 0
If the problem goes away (i.e. the page is visible) then your extended permissions are blocking access.
See http://wiki.apache.org/httpd/13PermissionDenied for details.
Selinux is not expecting the http server to access files under /home/domain since it is not a standard path.
You can change it with following command:
chcon -R --type=httpd_sys_rw_content_t /home/domain/public_html/