Server-side includes (SSI) stop working when on https (ssl) - ssl

My server side includes work fine when accessing the website through http, but when trying to access the site securely (which is all set up sweet) they just don't get included.
I'm using the following code in the one file inside my apache2/sites-enabled directory:
<Directory /var/www/html>
Options +Includes
AddType text/html .htm
AddOutputFilter INCLUDES .htm
</Directory>
Any ideas about where to look?

Got it. I had only put the above code into the virtualhost section for the ordinary port, not the ssl port.

Related

Apache 2, mod_fastcgi, REST: Handle requests to different URIs with the same application

I am trying to develop a RESTful service using Apache 2 and mod_fastcgi as my transport and security layer.
What I am trying to achieve is that a C++-application is called when a request is made. Then I want to use the HTTP method and the URI to decide (inside the application) which of the (internal) resources should be accessed and in which way.
Calling my C++-FastCGI application works (located # /var/www/html/foo/fastcgi_test). But only with a specific URI - the URI where my binary is located:
If I open http://127.0.0.1/foo/fastcgi_test in a browser my application runs and returns a html test page like I want.
Trying e.g. http://127.0.0.1/foo/bar returns a page with a 404. But I would like the same application to be called (fastcgi_test).
My configuration (so far) looks like this:
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/lib/apache2/fastcgi
<Location /foo>
SetHandler fastcgi-script
</Location>
FastCgiServer /var/www/html/foo/fastcgi_test -flush
</IfModule>
I read the mod_fastcgi manual and dug through the Apache manuals, but I can't find the right hint. It seems I don't seach for the right key word.
As I am very new to Apache configuration I maybe/hopefully just miss the right starting point.
How do I configure Apache/mod_fastcgi to send requests to a "branch of URIs" to the same FastCGI process? Can somebody provide a pointer?
The key is to use an alias. I also moved the FastCGI program out of the content area of Apache into a separate directory (/var/www/fastcgi).
My solution looks like this:
<IfModule mod_fastcgi.c>
FastCgiIpcDir /var/lib/apache2/fastcgi
<Directory /var/www/fastcgi>
SetHandler fastcgi-script
</Directory>
<Location "/foo">
Require all granted
</Location>
FastCgiServer /var/www/fastcgi/fastcgi_test -flush
AliasMatch "/foo(.*)" "/var/www/fastcgi/fastcgi_test"
</IfModule>

How to add .htaccess rules inside <VirtualHost> or inside the httpd.conf file

A short explanation of what I'm doing is: I need to automatically create virtualhosts for each ip address on my machine, make it point to the vsftpd user directory (/home/xxx) and deny any kind of scripts from being executed.
I want to stop any kind of webpages and especially PHP scripts from being executed, because it would post a huge security risk(apache is sudo). The purpose of this virtualhost is purely to serve game resource files, extentions like .wav , .mdl , .tga , .spr and so on.
I searched around and found this
deny from all
<filesmatch "\.(avi¦wmv¦mpg¦mov)$">
Allow from all
</filesmatch>
But this is .htaccess content. How can I implement this functionality of only allowing certain extentions inside my httpd.conf file? It would be a pain to make it use .htaccess, and a risk because users might edit them.
Please refrain from any comments unrelated to my question, such as "sudo apache? you're a dumbass" and so on.
There is no such thing as .htaccess only content. The is a huge misconception. Most of time you do NOT want to use .htaccess and Apache recommends that you not use it unless necessary. Apache rules can always be put in the server config.
When not to use .htaccess
Now you can put that in your VirtualHost directive. The same location where your document root is defined.
The FilesMatch directive can be used in these context.
Context: server config, virtual host, directory, .htaccess
http://httpd.apache.org/docs/current/mod/core.html#filesmatch
So in your vhost file you can add a Directory directive like this example.
<Directory /path/to/documentroot/>
Deny from all
<FilesMatch "\.(avi|wmv|mpg|mov)$">
Allow from all
</FilesMatch>
</Directory>
If you are using Apache 2.4 then you need to use Require.
<Directory /path/to/documentroot/>
Require all denied
<FilesMatch "\.(avi|wmv|mpg|mov)$">
Require all granted
</FilesMatch>
</Directory>

Apache Server Side Includes - JSP WLS Plugin

I am running Apache 249 and attempting to use SSI via a weblogic application.
I have added the following lines to my config file.
AddType text/html .jsp
AddOutputFilter INCLUDES .jsp
And have added the Options Includes both to the virtualHost and below.
<Directory "/apache/htdocs">
Options Indexes FollowSymLinks Includes
AllowOverride None
Require all granted
</Directory>
If I acces a test SSI file from within /apache/htdocs it works fine, however if I use a Location block using the Weblogic Plugin it doesn't work.
Any idea what I am missing here?
You need to use SetOutputFilter Includes within your Location Block that will process the .jsp file from the proxy before passing to the client, allowing the Virtual Include to work.

Problems setting up roundcube virtualhost for every subscription on server

Im trying to finish the set up of roundcube by adding a virtualhost so every subscription on server will use the webmail.servername.com to access it.
I have uploaded this roundcube.conf file with the code:
<VirtualHost ip-one:7080 \ ip-two:7080 \ local-ip:7080>
ServerName roundcube.webmail
ServerAlias roundcube.webmail.*
ServerAdmin "fdmatte#gmail.com"
DocumentRoot "/var/www/roundcube/"
<Directory "/var/www/roundcube/">
Options +FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
</IfModule>
# This is needed to parse /var/lib/roundcube/.htaccess. See its
# content before setting AllowOverride to None.
AllowOverride All
order allow,deny
allow from all
</Directory>
The issues im having are the following:
Using this file when i access my a website like http://www.mywebiste.com it gets routed to http://mywebsite.com
When i access webmail.mywebsite.com roundcube gets loaded but it cant find included files like css and js
It only works correctly if i access the ip-one:7080, then it works fine load up all css and js and i can login, check and send emails.
Is there something wrong with my settings?
Im using a plesk 11.5.30
Redirect http://www.mywebiste.com -> http://mywebsite.com can be switched off in Domain's hosting setting it's "Preferred domain" dropdown
Second issue can appears if you have wildcard subdomain *.mywebiste.com, this is well know plesk 11.5 bug so you can just ask Paralles support for solution. (You can workaround it by youself via customizing virtual hosting templates, but you should know how all this plesk backend works).
It's works for ip-one:7080 because Plesk 11.5 don't configure nginx webmail's config for every domain, just for wildcard webmail.*. So, nginx choose "wrong" virtual server and point it to virtual server of this wildcard subdomain which has location "/internal-nginx-static-location/" where static files will be looking by nginx(he know that is is static files because Plesk apache module mod_aclr2 provide such info for him ), but this location point to vhost folder of subdomain.
It's maybe something else, but I can't say more accurate just by your description.

WAMP virtualhost wont redirect

Ok I had to move my web to a new host. However new one is running Win 7 ultimate instead of 2008 R2.
To make sure i wont forget something moved over the existing WAMP Apache/PHP versions (bin folders).
It all works fine, except that virtualhosts simply wont redirect to the new documentroot.
it includes the virtualhosts conf file.
NameVirtualHost 88.159.116.217:90 should redirect to
C:/wamp/www/update/ but instead still directs to C:/wamp/www/
This setup worked fine on the 2008 R2. But now its simply ignoring everything defined in the included vhost.conf.
No errors (except that if my software connects to 88.159.116.217:90 - the files are not found since its root folder instead of update).
Code:
ServerAdmin hidden
ServerName hidden
DocumentRoot "C:/wamp/www/update/"
CustomLog logs/rfpatch.log combined
ErrorLog logs/rfpatch_err.log
<Directory "C:/wamp/www/update/">
Options -Indexes MultiViews FollowSymLinks IncludesNoExec
AllowOverride None
AddOutputFilter Includes html
Order allow,deny
Allow from all
AddType application/zip .tmp
AddType application/zip .cab
<Files update.dll>
AddType application/x-httpd-php .dll
</Files>
</Directory>
I don't need a hosts file - I'm not using domains.
There is no admin access problem (uac is also disabled).
the included vhost conf file is loaded - but vhost definitions are ignored.
The Apache version is the same as it was in the 2008 R2 server.
I can only think of two things...
You've not restarted Apache. It needs to be restarted for configuration changes to take effect.
Your Browser is caching the old page... Close all browser windows and tabs, then open the page and press CTRL-F5 to do a hard refresh. Also try clearing the browser cache data, it sometime "remembers" redirects and uses them over and over.