Trouble configuring trac to work with Apache2 [closed] - apache

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I've been trying to set up trac to be deployed with apache for a little while now and I'm running into a wall.
I can get it to work via tracd but I'm probably going to have multiple projects and I might want to use TSL for connections to trac.
This is the response I'm receiving from my server
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.14 (Ubuntu) Server at ***.***.***.*** Port 80
This is my apache v-host file: (Comments removed)
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DirectoryIndex index.html
DocumentRoot /home/***/public_html/app/public
Alias /trac/chrome/common /home/***/trac/htdocs/common
Alias /trac/chrome/site /home/***/trac/htdocs/common
ScriptAlias /trac /home/***/trac/cgi-bin/trac.fcgi/
DefaultInitEnv TRAC_ENV /home/***/trac
<Location "/trac">
SetEnv TRAC_ENV_PARENT_DIR "home/***/"
</Location>
<Directory "/home/***/trac/htdocs">
Order allow,deny
Allow from all
</Directory>
<Location "/trac/chrome/common">
SetHandler none
</Location>
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>
ErrorLog /home/***/public_html/app/log/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /home/***/public_html/app/log/access.log combined
CustomLog /home/casey/public_html/app/log/access.log combined
</VirtualHost>
And this is my server's error log:
[Fri Apr 29 02:09:06 2011] [warn] [client **.**.**.**] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Apr 29 02:09:06 2011] [error] [client **.**.**.**] Premature end of script headers: trac.fcgi
[Fri Apr 29 02:09:06 2011] [debug] mod_deflate.c(615): [client **.**.**.**] Zlib: Compressed 618 to 384 : URL /trac/
[Fri Apr 29 02:09:08 2011] [warn] [client **.**.**.**] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Apr 29 02:09:08 2011] [error] [client **.**.**.**] Premature end of script headers: trac.fcgi
[Fri Apr 29 02:09:08 2011] [debug] mod_deflate.c(615): [client **.**.**.**] Zlib: Compressed 618 to 384 : URL /trac/
Does anyone know what might be going on and what I should do to fix it? Thanks!

Is this on Windows? As noted in this question, running Python with FastCGI on Windows is bound to fail.
I recommend switching to mod_wsgi which is the recommended approach anyway.

Related

Apache2.4.6 Webdav not working on Centos7

I have installed Apache 2.4.6 on Centos7 official.
httpd.conf was not changed from default.
Configured webdav.conf with the following:
DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/webdav/
ErrorLog /var/log/httpd/error.log
CustomLog /var/log/httpd/access.log combined
Alias /webdav /var/www/html/webdav
<Directory /var/www/html/webdav>
DAV On
</Directory>
</VirtualHost>
webdav directory has 755 rights. DavLock not created.
I keep getting this error and not sure what the cause might be. Have tried many things without success:
[Fri Jan 29 11:41:17.027110 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] The locks could not be queried for verification against a possible "If:" header. [500, #0]
[Fri Jan 29 11:41:17.027134 2021] [dav:error] [pid 15068] [client xxx.xxx.xxx.xxx:53946] Could not open the lock database. [500, #400]
[Fri Jan 29 11:41:17.027137 2021] [dav:error] [pid 15068] (13)Permission denied: [client xxx.xxx.xxx.xxx:53946] Could not open property database. [500, #1]
any ideas are welcome
Got it working now.
all files/folders under /var/www/ are chown to apache
moved DavLock to here: /var/lib/dav/
and added this line under httpd.conf:
<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/DavLock
</IfModule>
At this point, I am getting 403 error. Solved by executing the following:
chcon -R -t httpd_sys_content_rw_t /var/www/html/webdav/

My WSGI application cannot be loaded as Python module. What am I doing wrong

I have been trying to get a WebAPI to run on the server. However I keep getting this error everytime I log into the site via the web browser
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, jordi.duch#gmail.com and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.
More information about this error may be available in the server error
log. Apache/2.2.22 (Ubuntu) Server at complex.ffn.ub.es Port 80
I check the error log file and I have the following.
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] mod_wsgi
(pid=21450): Target WSGI script
'/home/xarxes_ub/python_code/configure.wsgi' cannot be loaded as
Python module.
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] mod_wsgi
(pid=21450): Exception occurred processing WSGI script
'/home/xarxes_ub/python_code/configure.wsgi'.
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] Traceback
(most recent call last):
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] File
"/home/xarxes_ub/python_code/configure.wsgi", line 10, in
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] from
MenuUB2 import app as application
[Thu Jul 14 17:16:08 2016] [error] [client 161.116.80.82] ImportError:
No module named MenuUB2
I configured my .wsgi file based on the directions given on this site
http://flask.pocoo.org/docs/0.11/deploying/mod_wsgi/
It mentions specifically "Keep in mind that you will have to actually install your application into the virtualenv as well. Alternatively there is the option to just patch the path in the .wsgi file before the import:
import sys
sys.path.insert(0, '/path/to/the/application')" Which is what I did
Here is the configure.wsgi file
import sys
sys.path.insert(0, '/home/xarxes_ub/python_code/MenuUB2.py')
from MenuUB2 import app as application
In addition here is my apache configuration file that I edited. I highlighted the lines I added with ###.
<VirtualHost *:80>
DocumentRoot /var/www/web_del_grup/
################Added lines###############
WSGIScriptAlias /submitFrame /home/xarxes_ub/python_code/configure.wsgi
WSGIDaemonProcess MenuUB2 user=www-data group=www-data threads=5
################Added lines###############
#####################Added Directory####################
<Directory /home/xarxes_ub/python_code>
WSGIScriptReloading On
WSGIProcessGroup MenuUB2
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
#####################Added Directory####################
ErrorLog /var/log/apache2/error.log
# Options -Indexes +FollowSymLinks MultiViews
# RewriteEngine on
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?complex.ffn.ub.edu [NC]
# RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?complex.ffn.ub.es [NC]
# RewriteRule ^/xarxesub/(.json)$ - [F,NC,L]
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Please tell me what needs to be done. If I can get this to work I'd be so relieved.
Also note that I tried changing the "configure.wsgi" file to return a static and it works
Example is here
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Alright turns out I had a mistake in my configure.wsgi file
I should name the folder that has the application and not the absolute path to the application so /home/xarxes_ub/python_code not /home/xarxes_ub/python_code/MenuUB2.py
Here is the edited configure.wsgi file
import sys
sys.path.insert(0, '/home/xarxes_ub/python_code')
from MenuUB2 import app as application

VirtualHost 500 error (Apache 2.4.10 / Debian)

Good Morning StackOverFlow.. I have been troubleshooting this for quite a while.
Problem: When I try to access http://newdash.new it returns a 500 error. This happens both when accessing the URL locally and over the LAN.
Running on Debian8 with Apache 2.4.10
Below is my
/etc/apache2/sites-enabled/newdash.conf
Here:
<VirtualHost *:80>
ServerName newdash.new
ServerAdmin webmaster#localhost
DocumentRoot "/var/www/newdash/public"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/newdash/public">
Order allow,deny
Allow from all
# New directive needed in Apache 2.4.3:
Require all granted
</Directory>
</VirtualHost>
And the permissions:
drwxr-xr-x 11 root root 4096 Nov 13 10:51 newdash
I can ping the named route (newdash.new) both locally and over the LAN and the ip resolves properly.
In my Apache2 error log:
[Fri Nov 13 11:45:51.345101 2015] [:error] [pid 1958] [client 10.1.1.108:56899] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/newdash/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/newdash/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/newdash/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/newdash/vendor/monolog/monolog/src/Monolog/Logger.php(289):
So it appears there is a permissions error on that directory..
I don't know what other information would be helpful...
Thank you.
I found the error in the error log.
[Fri Nov 13 11:45:51.345101 2015] [:error] [pid 1958] [client 10.1.1.108:56899] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/newdash/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/newdash/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/newdash/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/newdash/vendor/monolog/monolog/src/Monolog/Logger.php(289):
As suggested, after looking there, I realized the permissions on the /storage/logs/ folder was causing the issues.
Thank you for the suggestion arkascha!

CGI script (Perl) running forever under Apache with fastcgi_module

I'm trying to run cgi scripts in Apache2 (Apache/2.4.6 (Ubuntu)) using fastcgi_module. This is the virtual host I set up
<VirtualHost *:8080>
ServerName cgi.local
DocumentRoot /home/noobeana/CGI
<Directory /home/noobeana/CGI>
AllowOverride All
Order allow,deny
Allow from all
Require all granted
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
SetHandler fastcgi-script
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And this is the Perl script (properly 775'ed) I created to run the tests (/home/noobeana/CGI/test.pl):
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello there!<br />\n";
The path to the Perl executable is indeed /usr/bin/perl and everything else looks fine, but when I open http://cgi.local:8080/test.pl in a browser the script is run forever - I have to stop Apache to force an exit. Also, the print is being output to Apache's error log (not the browser), which displays a multitude of the following lines for as long as the script is running:
[Fri Feb 07 10:24:54.059738 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" started (pid 4771)
Content-type: text/html
Hello there!<br />
[Fri Feb 07 10:24:54.078938 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" (pid 4771) terminated by calling exit with status '0'
[Fri Feb 07 10:24:59.663494 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" restarted (pid 4773)
Content-type: text/html
Hello there!<br />
[Fri Feb 07 10:24:59.665855 2014] [:warn] [pid 4708:tid 140365322880896] FastCGI: (dynamic) server "/home/noobeana/CGI/test.pl" (pid 4773) terminated by calling exit with status '0'
I'm not sure whether the two problems (the print not being output in the browser and the script not terminating) are related or not.
What you're trying to do isn't possible. fastcgi_module can only run scripts that implement the FastCGI interface, which is not supported by the script you've written. Instead, fastcgi_module is repeatedly trying to start your "FastCGI" script, seeing it print some stuff and exit immediately - which FastCGI scripts shouldn't do - and scratching its head wondering what it's doing wrong.
A simple script that does implement the correct interface can be implemented using the CGI::Fast module:
#!/usr/bin/perl
use strict;
use CGI::Fast;
while (my $CGI = CGI::Fast->new) {
print $CGI->header();
print "Hello there\n";
}
(The FastCGI protocol is somewhat complex, so there's no reasonable way to implement it without using a module.)

Setting up pow.cx to use Apache for PHP apps

I've set up Pow and Apache the way they suggest in this tutorial. My httpd-vhosts.conf contains the following entry.
<VirtualHost *:80>
DocumentRoot /Users/michael/Dropbox/Development/test
ServerName test.dev
<Directory "/Users/michael/Dropbox/Development/test">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I'm still getting a 403 Forbidden when I got to http://test.dev/.
Error log says:
[Wed Nov 21 19:24:21 2012] [crit] [client 127.0.0.1] (13)Permission denied: /Users/michael/Dropbox/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Wed Nov 21 19:24:43 2012] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
Has anyone else had this problem?
This seems to have nothing to do with Pow. Apache doesn't have the necessary permissions to work within /Users/michael/Dropbox/Development/test.
Please check the permissions of this directory, I think they should be 755. Check them with:
cd /Users/michael/Dropbox/Development/
ls -l
And copy paste the line of the test directory.
The issue was the permissions. It finally worked when I chmod'd the full path to the directory I was working in to 755.
~/, ~/Dropbox, ~/Development...etc.
I'll bet there's a nicer way to do this, but it's working. So, there you go.