At clg.localhost/ I'm getting error:
You don't have permission to access / on this server.
But, following this, I've set up my Apache httpd.conf and sites.conf to allow access with AllowOverride all and Require all granted. What else am I missing?
Versions:
$ /usr/sbin/httpd -v
Server version: Apache/2.4.23 (Unix)
Server built: Aug 8 2016 18:10:45
Apache httpd.conf:
DocumentRoot "/Users/danniu/Sites"
<Directory "/Users/danniu/Sites">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
...
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride all
Require all granted
</Directory>
Apache sites.conf:
# Workaround for missing Authorization header under CGI/FastCGI Apache:
<IfModule setenvif_module>
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
</IfModule>
# Serve ~/Sites at http://localhost
ServerName localhost
<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
</VirtualHost>
I thought perhaps httpd.conf wasn't properly being picked up, so I specified the root directly in the Virtual Host, with the same issue.
<VirtualHost *:80>
ServerName clg.localhost
DocumentRoot /Users/danniu/Sites/CLG/CLG-dev
# Set access permission
<Directory "/Users/danniu/Sites/CLG/CLG-dev">
Require all granted
</Directory>
</VirtualHost>
/ is a directory, so if you don't have an index file pointed to with DirectoryIndex, such as index.html, and you don't have Indexes enabled, as you don't, Apache can't show contents of your documentroot.
Note you have Options FollowSymLinks Multiviews
The solution, to the Options add Indexes like follows for "directory listing" (this depends on mod_autoindex being loaded previously):
Options FollowSymLinks Multiviews Indexes
If you want a default file loaded, for example index.html, DirectoryIndex by default looks for index.html, so add it, or if something its overriding its behaviour somewhere else do:
DirectoryIndex index.html
Related
I want my wamp64 server webpages to can be access globally and not only from my local network.
<Directory />
AllowOverride none
Require all granted
</Directory>
<Directory "C:/wamp64/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order allow,deny
Allow from all
Require all granted
</Directory>
Now, if i try to access it from my mobile, there showing an empty (white) page. Same if i put at the url /folder_name
Apache file code here: http://pastebin.com/A7xxiQ6B
This section must never be changed Specially if you are allowing the universe into your site, as this protects the root and all sub folders on the drive that Apache is installed on. Standard process is to block access to EVERYTHING which this does, and then only allow access to those folders APache actually needs access to.
<Directory />
AllowOverride none
Require all granted
</Directory>
Change it back to
<Directory />
AllowOverride none
Require all denied
</Directory>
And in this part you are using Apache 2.2 AND Apache 2.4 syntax which normally gets Apache confused. So remove the Apache 2.2 syntax so it should look like this
# onlineoffline tag - don't remove
Require all granted
Of course you will also need to Port Forward post 80 on your router.
And the PC running WAMPServer will need to be on a static IP address so that that port forwarding always works.
Well, the followings working for me. Figure it out :)
Just add to C:\Windows\System32\drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost <-- Uncomment this
# ::1 localhost
127.0.0.1 xxxxxx.ddns.net <-- Add here your public IP or your Dynamic DNS name
If you have your httpd.conf as the following
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
ServerName xxxxx.ddns.net:80
<Directory "C:/wamp64/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Require all granted
</Directory>
and C:\wamp64\alias\phpmyadmin.conf
<Directory "C:/wamp64/apps/phpmyadmin4.5.2/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
..............
</Directory>
You will be able (probably) too see your wamp online.
Please note you have to configure your vhosts from localhost\add_vhost.php for your every project (www/folder_name) and change the C:\wamp64\index.php from
$suppress_localhost = true;
to
$suppress_localhost = false;
I have been struggling to get laravel php framework up and running on my mac with yosemite. I have made changes to both the httpd.conf file in /etc/apache2 as well as my user config file username.conf. Now after changing it back I get a 403 "Forbidden You don't have permission to access /~username/my_phpinfo.php on this server." Also I should not that I am using Apache/2.4.9. This is the user conf file I currently have:
<Directory "/Users/<username>/Sites/">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
I also feel like possible errors could be in this section (line number~=238) of the httpd.conf file:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options FollowSymLinks Multiviews
MultiviewsMatch Any
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Require all granted
Order allow,deny
Allow from all
</Directory>
I worked with Wamp Server for my work . today I manipulate httpd.config for connect directly to the directory. since I removed this line , wamp server doesn't go online , after I change to previous state and restart wamp , it's still offline. I use Windows 7 and Apache version 2.4.7
<Directory C:\wamp\www\Zend\workspaces\test\public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
could you try that ?
DocumentRoot "C:/wamp/www/Zend/workspaces"
ServerName local-portail.com
DirectoryIndex index.php
#AllowOverride All
#Allow from all
#Require all granted
or this
DocumentRoot "C:/wamp/www/Zend/workspaces"
ServerName local-portail.com
DirectoryIndex index.php
#AllowOverride All
#Allow from all
#Require all granted
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
Is this the section of httpd.conf that you changed?
<Directory "c:/wamp/www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>
If you want to make another directory the Directory root then a better way is to create a Virtual Host, or many virtual hosts, one for each project.
See this post for how to do that. Ignore the title, it is a post that describes how to setup Virtual Hosts. Project Links do not work on Wamp Server
On ubuntu 13.10 I am using apache 2.4.x . I was having problem with mod_rewrite. I enabled that module and and restarted the server but .htaccess file wasn't still working so I after some search, I read an answer from stackoverflow pointing towards: http://smarttips.in/htaccess-redirect-not-working-apache/
I was missing point 2 in the above link. So I put that code in my 000-default.conf file.
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
As I am using apache2.4+ so as told here: http://httpd.apache.org/docs/current/upgrading.html
Order allow, deny
Allow from all
to
Require all granted
Here is code in my 000-default.conf file:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
But after entering that code from that link, now server is giving 403 forbidden, saying:
You don't have permission to access /mysite/ on this server.
Apache/2.4.6 (Ubuntu) Server at localhost Port 80
So not sure if that mod_rewrite problem is solved or not but also getting now permissions error.
Let me know if I need to put .htaccess code here too.
So any idea what am I doing wrong ?
I simply removed:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
and put this instead:
DocumentRoot /var/www
<Directory /var/www>
AllowOverride All
</Directory>
And now that permission error is gone and mod_rewrite is working as expected.
Adding this to <Directory /var/www/html>
Options +SymLinksIfOwnerMatch
helped me.
I keep having this access denied error. I'm using apache 2.2.15 on CentOs 6.4.
The server is running with user apache and group apache.
In home, I have a user staging. I added him to the apache group.
Permissions on the docs folder are:
drwxrwx--- 2 staging staging 4096 Oct 4 14:33 docs
I'm testing with an index.html file:
-rw-r--r-- 1 staging staging 13 Oct 4 14:28 index.html
SELinux is disabled. The address I'm using is staging.mysite.com
My httpd.conf looks like this:
<Directory "/home/*/docs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
I also have a virtual host set to my staging address:
<VirtualHost SERVERIP:80>
ServerName staging.mysite.com
DocumentRoot /home/staging/docs
ServerAdmin staging#mysite.com
CustomLog /home/staging/logs/access_log combined
</VirtualHost>
If you need more info let me know but any idea why it's giving me this error?
Well, as you stated it, the docs folder is only readable by the staging user and the staging group. So the apache user may not read it.
One solution would be to add the apache user to the staging group.
I can fixed the same error:
To Modify at your nagios configuration the options parameter +Indexes and add DirectoryIndex index.php
Maybe show be:
<Directory "/home/*/docs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks +Indexes
DirectoryIndex index.php
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
And, finally restart your apache service.
Check the permission /home/ can be +x and +r, like chmod +rx /home/.