I have faced the same problem: "Internal Server Error with Ubuntu 12.04".
Everything looked OK to me (I even run successfully a perl fcgi script to test FCGI in my apache server). I continually got an Internal Server Error when I run a get Capabilities request. The apache log file said "Premature end of script headers: qgis_mapserv.fcgi".
The problem was solved when I included a previous QGIS generated project file into the cgi folder (in my apache installation was /usr/lib/cgi-bin).
Apparently, the qgis server searches for a project in the cgi folder and the error comes out if there is no project.
My problem is solved ! Not as i wanted but i have obtained the result i needed.
So, first, it's not really a bug in QGIS server.According severals sources, the reason why you can't display raster (based on a ECW file) layer in qgis server is due to a paid license : ERDAS ECW/JP2 SDK you can see here : download.intergraph.com/?ProductName=ERDAS%20ECW/JPEG2000%20SDK
You have to know that i haven't tested this solution because it's sounded too tedious for what i want (and secondarily i don't want to pay something without knowing if it will work).
But, if you want to try, here is some topic i found about this :
the problem : www.forumsig.org/showthread.php/37886-Probl%C3%A8mes-QGIS-Server
how to install the library : doc.ubuntu-fr.org/qgis
how to install the library : trac.osgeo.org/gdal/wiki/ECW
So ! This is not the solution a choosed.
I think you get that the problem is about ECW files and not about the entire rasters layers.
Starting from here, i simply used tif file instead of ecw as a raster and everything goes well !
Two solutions to get tif file :
-> you can convert ECW file into tif with QGIS Desktop (Menu -> Raster -> Conversion -> Convertir) : it's a very long process if you have a heavy ECW file. For example, it takes me 10mn to convert a 900Mo ECW to a 10GB tif
-> you can download tif map directly online (Example : professionnels.ign.fr/catalogue )
I realise i'm not so clear about the first point (about paid license etc). It's due to i don't really understand what is this lib...
Hope this will help some people.
Bye !
Best Answer
I have it working on Ubuntu 10.04/10.10 and 11.04. My first tutorial was this
http://linfiniti.com/2010/08/qgis-mapserver-a-wms-server-for-the-masses/ (broken link)
but under Ubuntu (with all installed from repos) is even easier.
Enter the cgi-bin folder, create a project folder, copy in there the project file and a copy of qgis_mapserv.fcgi, then add a metadata file.
The qgis project MUST be saved with absolute paths (for layers).