URL wants me to download a file - apache

I have a web application on Apache/Ubuntu 14.04 that was running fine until I upgraded the server to Ubuntu 18.04. Now when I visit the site, It automatically asks me to download a file. The file that it wants to download is the launch page of the web application. The file is called index.asp. I do have the dir module enabled.
<IfModule mod_dir.c>
DirectoryIndex index.asp index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
I also compared the apache modules from the server that has 14.04 to the 18.04 and they are identical.
Here is the vhost file.
<VirtualHost _default_:443>
ServerName xxxxxxxx.net
ServerAlias xxxxxxx.net
DocumentRoot /home/computer/xxx/xxxxxx/htdocs
<Directory /home/xxxxx/xxxxx/xxxxx/htdocs>
Options -Indexes +ExecCGI +FollowSymLinks
Require all granted
</Directory>
I did add this to the vhost file and restarted apache but id didn't work.
AddHandler php5-script .php .asp .aspx .ascx .ashx .asmx .pl
AddType text/html .php .asp .aspx .ascx .ashx .asmx .pl
No errors in the apache logs

Related

Apache 2.4 server not reading .htaccess file

We are setting up a new server, where we have installed Apache 2.4 and PHP 7.2. In our code structure we have an .htaccess file, but Apache is not accessing it.
We have modify the httpd.conf file and enabled the mod_rewrite and set
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
And restart Apache after this, but it is not picking .htaccess file from location - htdocs/myProject/.htaccess
strange but its work for me, in httpd.conf file, I have change -
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
to
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
And it work for me.
Thanks

SSI Not Working on Ubuntu 16.04 and Apache 2.4.18

I'm trying to run bWAPP SSI injection lesson. However it seems SSI doesn't work on my computer. I'm using PHP 5.6.30 and Apache 2.4.18 on Ubuntu 16.04. I've added the following to /etc/apache2/apache2.conf but not working
<Directory /var/www/html/bWAPP/>
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</Directory>
Adding the following to /var/www/html/bWAPP/.htaccess is also not working
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
I've restarted the Apache server but still not working.
Is there anything I have to do to enable SSI?
To enable ssl on Ubuntu/Apache-WebServer you need to take next steps on command line:
a2enmod ssl
a2ensite default-ssl.conf
service apache2 restart
For specific virtual host just copy default-ssl.conf to, for example, bwapp.conf and change that file similar to look like this
ServerName bwapp.youserver.com
ServerAlias www.bwapp.yourserver.com
ServerAdmin webmaster#yourserver.com
DocumentRoot /var/www/html/bwapp/
<Directory /var/www/html/bwapp>
Options FollowSymLinks
DirectoryIndex index.php
</Directory>
After that, enable this virtual host from command line
a2ensite bwapp.conf
service apache2 restart
Good luck.

Apache httpd bad request when accessing by ip address - Review Board

I have setup Review Board and it works fine when accessed from localhost.
When I try to access it by ip (from LAN), I get BAD REQUEST.
I have copied apache-wsgi.conf to my apache conf directory.
apache-wsgi.conf
<VirtualHost *:8088>
ServerName localhost
DocumentRoot "/var/www/reviews.als.kz/htdocs"
# Error handlers
ErrorDocument 500 /errordocs/500.html
WSGIPassAuthorization On
WSGIScriptAlias "/reviews" "/var/www/reviews.als.kz/htdocs/reviewboard.wsgi/reviews"
<Directory "/var/www/reviews.als.kz/htdocs">
AllowOverride All
Options -Indexes +FollowSymLinks
Require all granted
</Directory>
# Prevent the server from processing or allowing the rendering of
# certain file types.
<Location "/reviews/media/uploaded">
SetHandler None
Options None
AddType text/plain .html .htm .shtml .php .php3 .php4 .php5 .phps .asp
AddType text/plain .pl .py .fcgi .cgi .phtml .phtm .pht .jsp .sh .rb
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
</Location>
# Alias static media requests to filesystem
Alias /reviews/media "/var/www/reviews.als.kz/htdocs/media"
Alias /reviews/static "/var/www/reviews.als.kz/htdocs/static"
Alias /reviews/errordocs "/var/www/reviews.als.kz/htdocs/errordocs"
Alias /reviews/favicon.ico "/var/www/reviews.als.kz/htdocs/static/rb/images/favicon.png"
I have installed reviewboard into /var/www/reviews.als.kz directory.
Chown-ed it to apache:apache.
I run it on Fedora 21.
Review Board version 2.0.12
Apache httpd version 2.4.10
Thanks
The problem had been with python settings.
Added my ip address to ALLOWED_HOSTS within settings_local.py file and everything worked.
Thanks
I had the same problem. When you configure your reviewboard, you have to give it a site name . Some thing like "reviewboard.mycompany.com". It doesn't have to be a registered name just make up something.
Then when you try to access the reviewboard main page, use the site name (reviewboard.mycompany.com) as the URL. You'll of course need to add the made-up hostname to to your /etc/hosts so your machine can resolve the address.
Create a host entry / DNS entry with the site name. like
reivews.mycompany.com x.x.x.x
It's worked for me.
I had the same problem.
Fixed it by adding this line to my httpd.conf :
HttpProtocolOptions unsafe

Apache2 on Ubuntu 14.04 won't load index.php

Using the following posts:
Ubuntu 14.04 apache2 configuration problems
.htaccess file not working on Ubuntu 14.04 with apache2
Apache doesn't execute script of index.php in root automatically
I've changed my /etc/apache2/apache2.conf file to be the following:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory
And I've created the file /var/www/html/.htaccess to be the following:
DirectoryIndex Index.php index.php Index.html index.html Index.htm index.htm
When I go to my site, the default page is still the (It Works!) index.html file.
How do I configured Apache to give priority to index.php?
Is your DocumentRoot /var/www/ or /var/www/html/ (the latter is where you say you have your .htaccess file)??
If the .htaccess is in /var/www/html/ than I'm gonna guess you need to update your Apache config to be:
<Directory /var/www/html/>

CF file not found with Apache virtual hosts

I have Apache 2.2 configured to run with Coldfusion 9.2, both on the same Centos 6.2. The general config of DocumentRoot in Apache is
DocumentRoot "/var/www/html"
Up until now Apache handed all calls to cfcs and cfms over to Coldfusion. I then created a virtual host
<VirtualHost 192.168.123.207:80>
ServerName myserver.server.private
ServerAlias www.myserver.server.private
ServerAlias webmail.myserver.server.private
ServerAlias admin.myserver.server.private
DocumentRoot /home/myserver/public_html
ErrorLog /var/log/virtualmin/myserver.server.private_error_log
CustomLog /var/log/virtualmin/myserver.server.private_access_log combined
ScriptAlias /cgi-bin/ /home/myserver/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/myserver/public_html>
Options +Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All
Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
<Directory /home/myserver/cgi-bin>
allow from all
AllowOverride All
Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.myserver.server.private
RewriteRule ^(.*) http://myserver.server.private:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.myserver.server.private
RewriteRule ^(.*) http://myserver.server.private:10000/ [R]
</VirtualHost>
When I open a html file on http://myserver.server.private/hello.html, the correct file within the virtual host document root (/home/myserver/public_html) gets served.
Calling a cfm fails though. Apache passes the request on correctly but then a Coldfusion error message shows up:
File not found: /hello.cfm
It seems that Coldfusion is getting the file name, prefixes a wrong directory path to it and fails loading it from the disk.
I scanned all Coldfusion files for a wrong document root but could not find anything.
EDIT
It turns out that Coldfusion looks into it's own webroot directory at
/opt/coldfusion/wwwroot
I placed a file with the same name but different content there and that one gets served, although there is a) a virtual host and b) the general DocumentRoot is set to /var/www/html.
It turns out that the coldfusion user (cfusion in my case) needs to be in the group of the virtual host user.
usermod -a -G newuser cfusion
After a restart of coldfusion, all works.