apache2 is throwing internal server error 500 after AllowOverride All, localhost - apache

i am new in configuring server. For now, i have to configure localhost with LAMP and opencart framework. But still it is throwing internal server error 500.
Even I have tried the following things
sudo a2enmode rewrite
apache2ctl configtest // for syantax
apache2ctl -t // for syntax
/etc/apache2/sites-available/000-default.conf file
ServerName localhost
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
<Directory "/var/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
/etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
/var/www/opencart/.htaccess
Options +FollowSymLinks
Header add Access-Control-Allow-Origin "*"
RewriteEngine On
RewriteBase /ot
RewriteCond $1 !^(robots\.txt)

After checking the logs, i have found invalid parameters headers. Therfore for this we have to this:
sudo a2enmode headers

Related

Htaccess issue with RewriteOptions InheritBefore

I have got two htaccess:
api/public/.htaccess
RewriteRule . index.php
api/public/cron/web/.htaccess
RewriteEngine On
RewriteOptions InheritBefore
I set my vhost for cron:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName cron.api.local
ServerAlias www.cron.api.local
DocumentRoot /var/www/api/public/cron/web
ErrorLog ${APACHE_LOG_DIR}/api_cron_error.log
CustomLog ${APACHE_LOG_DIR}/api_cron_access.log combined
<Directory "/var/www/api/public/cron/web">
Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
Url http://cron.api.local/up returns 404 status but when i replace RewriteOptions InheritBefore with RewriteRule . index.php then it works. What is wrong?
I use apache 2.4.18 and ubuntu 16.04.
To fix this issue follow this:
sudo nano /etc/apache2/apache2.conf
Find:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted </Directory>
Replace With:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Exit and save and restart apache with command
sudo systemctl restart apache2
Reverence:
Apache mod_rewrite is enable on server but not working?

500 Internal Server Error when trying to enable use of .htaccess in Apache on Ubuntu

I am trying to get my .htaccess working on my Ubuntu-apache2-webserver.
For that I opened /etc/apache2/apache2.conf,
I removed the comment sign (#) before AccessFileName .htaccess
and replaced AllowOverride None by AllowOverride All in
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I activated mod_rewrite via a2enmod rewrite and restarted the server.
But each time I am performing those changes and open an html-file placed inside of /var/www/html, I get a 500 Internal Server Error for Virtual Host 80.
The same thing happened to me when placing
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
before </VirtualHost> into the 000-default.conf-file instead of the /etc/apache2/apache2.conf.
Can anyone tell me what I am missing?
You're slightly off in your syntax for allowOverride. The Directory tag needs to be inside the VirtualHost tag. Like so:
<VirtualHost *:80>
DocumentRoot /var/www/html
ErrorLog /var/log/apache2/error.log
Options Includes
<Directory "/var/www/html">
AllowOverride All
</Directory>
</VirtualHost>
Also, make sure Apache has permissions to read and write to the directory /var/www/html

Ubuntu 14.04 Apache 2.4.7 404 Not Found

I've been reading the forums and trying to replicate their fixes, but I must be missing something on my end since it will switch from a simple 404 Error Not Found to a 403 Forbidden Error (even after chown and chmod changes).
Currently, I am experiencing the 403 error code even after a sudo apache2ctl restart
Here is what I've done so far.
- gedit apache2.conf with the following
<Directory /path/to/directory/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
</Directory>
gedit sites-available/000-default.conf && sites-enabled/000-default.conf
DocumentRoot /path/to/directory
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /path/to/directory>
Options Indexes FollowSymLinks MultiViews
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
Any help is much appreciated.
First note that you have now Apache 2.4, not Apache 2.2. The style to declare permissions has changed with Apache 2.4 and you should consistently use the new ones (like require all granted).
Apache has become more strict in what files it allows to be served. Essentially, arrange the files to be served outside in your Document Root and below, and keep all other files out of this tree. Don't link to files outside the Document Root tree.
Some point of your config:
<Directory />
This is the root directory of your file system. If you declare anything for it, it should be require all denied and nothing else. Note that there is a difference between a <Directory /absolute/path/to/some/directory> directive and a <location /relative/path/to some/location/on/your/server> directive.
Configure your server in terms of <location>

Apache: Install Baikal besides Seafile

I need a hint in which direction I should look for an answer on this.
I have set up a Seafile server which is accessible under https://subdomain.no-ip.org, i now want baikal to be accessible under https://subdomain.no-ip.org/baikal
However, I can't get it running because i always get a message from Seafile that this directory does not exist. (I guess seafile thinks it should be a subdirectory)
my recent try to configure apache -
sites-enabled/default-ssl
<VirtualHost *:443>
ServerAdmin webmaster#localhost
Servername gasslnet.no-ip.org
DocumentRoot /var/www
Alias /media /home/andie/seafile-directory/seafile-server-latest/seahub$
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/baikal/html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
My Seafile-Settings:
ccnet/ccnet.conf
SERVICE_URL = https://subdomain.no-ip.org
seahub_settings.py
FILE_SERVER_ROOT = 'http://subdomain.no-ip.org/seafhttp'
I think the issue is in the seafile configuration, if seafile would be accessible under url/seafile and not only the url the problem should be solved. I tried changing the SERVICE_URL, but no effect.
Do you have any ideas about this?
You have to set
SITE_ROOT = '/seafile'
in the seahub_settings.py to access Seafile under
http://subdomain.no-ip.org/seafile

AllowOverride for .htaccess on local machine giving 403 Forbidden

I have a mod_rewrite I'd like to use locally on my mac but when I change my configuration to in my directory tag I get a 403 Forbidden error. I've tried all the other solutions around but no luck.
Maybe somebody will see something I am not...
Here is the code:
httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "/Library/WebServer/Documents/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Which is overridden by myusername.conf
<Directory /Users/adrianmaurer/Sites/www>
Options Indexes MultiViews FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Virtual host file httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Users/adrianmaurer/Sites/www
ServerName myserver.dev
</VirtualHost>
I was able to get it fixed by setting my /etc/apache2/users/username.conf file like so (Note you have to change the Options line too, not just the AllowOverride):
<Directory "/Users/tlhunter/Sites/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>