"AllowOverride not allowed here" in WAMP - apache

I have enabled mod_rewrite (it's checked in the WAMP icon in my taskbar and uncommented in httpd.conf) and I've made sure any AllowOverride settings in httpd.conf are set to All, yet I'm still getting a 500 error message and
[alert] [client 127.0.0.1] E:/mywebsite/html/.htaccess: AllowOverride not allowed here
in my Apache error log.
Could it be a result of changing the DocumentRoot to a completely different one? I installed WAMP on D:\ and changed the root to my Dropbox folder on E:\.
Is there an extra conf file WAMP has that sets special settings like XAMPP does?
Why am I still getting this error? I've searched the internet high and low for an answer, yet they all tell me to enable that module and I have done.
On Windows 7, WAMP 2.2.

Just moving my comment as answer since it seems to have resolved OP's problem.
Looking at error it seems there is a AllowOverride line in E:/mywebsite/html/.htaccess and Apache is throwing 500 error because AllowOverride isn't allowed in .htaccess.

Related

Apache2: Cannot access Userdir - Forbidden

I am trying to run Apache 2.4 on Ubuntu 21.10. However, I cannot get userdir to work. I did everything I can possibly google, except reinstalling apache. I am normally a Windows person, so this is driving me nuts.
What I did:
Enable userdir.conf
Set Permission of the folder public_html into 777, and change ownership to www-data
Add Require all granted to literally everywhere I can think of: apache2.conf, userdir.conf, and the config in sites-available to include
<Directory /home/*/public_html >
Require all granted
AllowOverride All
Options +Indexes
</Directory>
Yet, for some reason, all I have is ERROR 403: Forbidden when trying to go to http://localhost/~myusername
What could I possibly be missing?
Thank you.
It turns out it is "because search permissions are missing on a component of the path". So just "chmod -R 755" my entire home folder. Probably not that good of a solution, but still, it works.

403 Forbidden : Apache not working after moving document root folder to iCloud drive

So i'm using MacOS Catalina and my Apache environment was running sweet until i decided to move my document root to the iCloud drive, to keep it backed up.
Before my document root was :
/users/admin/www
And now it is
/users/admin/Library/Mobile Documents/com~apple~CloudDocs/www
I edited httpd.conf accordingly :
DocumentRoot "/users/admin/Library/Mobile Documents/com~apple~CloudDocs/www"
<Directory "/users/admin/Library/Mobile Documents/com~apple~CloudDocs/www">
Options FollowSymLinks Multiviews SymLinksIfOwnerMatch
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
<Directory "/users/admin/Library/Mobile Documents/com~apple~CloudDocs/www/myfolder">
Options +FollowSymLinks +Multiviews +SymLinksIfOwnerMatch
MultiviewsMatch Any
AllowOverride All
Allow from All
Require all granted
</Directory>
Restarted Apache, restarted the machine but now i can access 127.0.0.1, EXCEPT one specific folder (let's call it www/myfolder). When i try to access 127.0.0.1/myfolder, i get the error below :
Forbidden
You don't have permission to access / on this server.
Checking the apache log file, this is the error i'm getting :
[Thu Oct 24 14:00:24.830700 2019] [access_compat:error] [pid 61703] [client 127.0.0.1:57804] AH01797: client denied by server configuration: /users/admin/Library/Mobile Documents/com~apple~CloudDocs/www/myfolder/public_html/
What am i missing here ? Please help, i need to work :D
First thing I am seeing is that you are using Apache 2.4 style syntax in your directory block, but then in your error log the module throwing the error is
access_compat. Per the Apache documentation:
The directives provided by mod_access_compat have been deprecated by mod_authz_host. Mixing old directives like Order, Allow or Deny with new ones like Require is technically possible but discouraged. This module was created to support configurations containing only old directives to facilitate the 2.4 upgrade
Next clue is the error code: AH01797. This is caused by a server configuration issue:
Client denied by server configuration
This error means that the access to the directory on the file system was denied by an Apache configuration.
I am assuming here that you are actually using 2.4, and that access_compat is enabled by mistake.
Take a look through your configuration files again, and find the LoadModule directive that is loading mod_access_compat, and comment it out. It might be in your httpd.conf file, but there are numerous different styles of organizing and configuring an Apache install, so it could be elsewhere. If you have a Debian-style install, you need to remove the symbolic link /etc/apache2/mods_enabled/mod_access_compat. Grep -R access_compat * might help.
EDIT 2 more observations:
In the second directory stanza, you have
Allow from all
Require all granted
Which is mixing old directive syntax with new, and is also redundant. Disable access_compat again, and also remove that Allow from all line before restarting Apache.
I don't think the second directory stanza is even necessary. You could probably delete the whole block and restart the server, and it would work.
First try (1) by disabling access_compat and removing that Allow directive from your httpd.conf file, and restart apache using apache2ctl -k graceful. If that doesn't work, comment out the entire second directory stanza and restart again.
I am about 50% sure this will fix it. If it doesn't then I will really need to see your entire httpd.conf file before I can troubleshoot further.

Apache won't autoindex

Oracle Linux 7.3 (RHEL derivative)
Apache 2.4.6
I'm setting up a repository in /srv/www for yum, scripts, and kickstart files, served via httpd. I want an auto-index, so I don't have any index.html. And, this is the only thing this internal server will do. So, httpd.conf:
DocumentRoot "/srv/www"
<Directory "/srv/www">
AllowOverride all
Options Indexes FollowSymLinks
Require all granted
</Directory>
However, I still get the error message:
[autoindex:error] [pid 12345] [client <IP address>:<port>] AH01276: Cannot serve directory /srv/www: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive.
Except that the Options directive allows auto-indexing! I've tried Options All. I've tried Options +Indexes +FollowSymLinks. I've looked at 7 or 8 Google hits. Nothing is working.
Setting LogLevel debug doesn't increase messaging.
What have I missed?
As noted here, in the absence of an index.html (or other configured index file), the welcome page configured at /etc/httpd/conf.d/welcome.conf will take precedence over other configurations via its LocationMatch directive. Rename the file so it doesn't end in .conf and auto-indexing works.
Obviously landing in another virtualhost or Directory without indexes enabled, or a .htaccess getting in the way.
Set "AllowOverride none" first, since it is absurd to have it active if you are not using any .htaccess file (and since you have access to the main server you don't need it). Once you set AllowOverride, restart the server in case you added Indexes recently and didn't restart to apply changes.
If the issue persists, run apachectl -S and make sure you are landing in the correct virtualhost.
I just want to add that, after updating my mac to Catalina, my apache stopped working with that same error.
I had to:
uncomment the required modules (php7, rewrite, directory, etc...)
add a + sign to the Options (Options +FollowSymLinks +Multiviews +Indexes)
This worked for me.
Solution:
Ensure two apache modules are running:
mod_autoindex.so
mod_dir.so
In your case, mod_autoindex.so is running. Now enable the second one.
PS: Keep Options -Indexes. It's important. It makes sure that directory listings are disabled, as you shouldn't allow anyone to pay a visit to every directory on your server (some with rather private content such as CMS's directories).

Rewrite Module not Working

I installed last night wamp on my win 7 laptop and started creating a small framework for my projects,
But when I firstly added the RewriteEngine on,it just wasn't working. So I checked to see if the module was on, After I edited the conf file and restarted the server and also checked on apache mods under wamp menu, i confirmed that it was on. So i try to check the page again and I still get an internal server error. So i check the conf file again to check directories permission settup and it seems fine.
So then I go go the error logs and I find Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration. I checked if the .so file actually exist. I dont know what else to try, please help me before i go nuts.
<Directory >
AllowOverride none
Require all denied
</Directory>
<Directory "c:/wamp/www/">
AllowOverride All
Allow From All
Require all granted
</Directory>
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
Since it didn't make sense to me why the RewriteEngine wasn't working (code wise). I suspect there was something wrong with my Wamp installation (it would work in the background even after I close it) even though it was a fresh installation. So I decided to re-install the Wamp server, change the Apache conf file and everything is working fine now.

EasyPHP modules folder conflicts with Drupal

I installed EasyPHP and set up a Drupal installation and a virtual host, so that I could see my site at sitename.local in my browser.
At first, it seemed like it was working, but it looked odd. The size of the text was different and certain page elements were displayed that were supposed to be hidden.
I found that the CSS was not loading from /modules/system. This was odd, because other CSS files would load fine. When I tried to access those CSS files directly, EasyPHP would throw "Object not found!"
So I tried navigating in my browser to sitename.local/modules. I would expect it to say "Access forbidden", but instead it showed the index of the EasyPHP modules folder.
I looked in httpd.conf and found this line, which seems to be the culprit:
Alias /modules "${path}/modules"
If I comment out that line, my site works normally, but I run into errors in EasyPHP because the module path is not found.
Is there way to rewrite this line so that it only redirects 127.0.0.1/modules and not sitename.local/modules?
Jus run into the same problem on EasyPHP 14.1VC11 and Drupal 7.26
Adding alias in virtualhost configuration worked for me:
<VirtualHost *:8080>
DocumentRoot path-to-site-folder
ServerName site-name
Alias /modules "path-to-site-folder/modules"
<Directory "path-to-site-folder">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
The correct answer is actually the answer posted by #ahokkonen, but without the **.
So, adding Alias /modules "path-to-site-folder/modules" solves the issue (I just did this and it works.