Trac Logo issue - bug-tracking

I installed trac (v 0.11.7) on my debian box. Everything runs fine except I couldn't get logo to display. I used mod-wsgi and deployed the project to a folder named 'deploy'. Inside deploy folder, I have a htdocs folder that has two subfolders: common and site. I changed the [header_logo] of trac.ini so it read
src=site/logo.jpg
width=200
height=100
It won't display while logo.jpg was stored under site folder. When I changed the src to common/trac_logo_mini.png, it did show up. I then moved my logo.jpg to the common subfolder and changed the src to common/logo.jpg. Still no go.
In my browser if I used
https://192.168.1.10/myproject/chrome/common/trac_logo_mini.png
, the browser would showed the picture. When I copied trac_logo_mini.png to mylogo.png and used
https://192.168.1.10/myproject/chrome/common/mylogo.png
, the browser won't display mylogo.png.
I wonder why.
Here is my settings.
I did trac-admin myproject/env deploy myproject/deploy.
The logo is in myproject/deploy/site folder.
In the default-ssl file, I have
WSGIScriptAlias /myproject /trac_pool/myproject/deploy/cgi-bin/trac.wsgi
<Directory /trac_pool/myproject/deploy>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
<Location "/myproject">
AuthType Basic
AuthName "My Project Trac"
AuthUserFile /trac_pool/myproject/trac.htpasswd
Require valid-user
</Location>'

Here is how my server is set up, it may help resolve your issue.
trac.ini:
[header_logo]
src = site/mylogo.gif
File system:
/srv/trac$ ls -1F
attachments/
conf/
db/
deploy/
htdocs/
log/
plugins/
README
templates/
VERSION
/srv/trac$ ls -1F htdocs/
mylogo.gif
index.html#
print.css
site_custom.js
style.css
Essentially, using the 'site/' prefix in trac.ini maps to the 'htdocs' folder in the Trac folder hierarchy.

I also had problems with my trac logo. It turned out that the file permissions were such that user www-data could not read the logo file. Fixed that through chmod +r <logofile> and the problem was gone.

Have you tried setting the src of your logo to just src=/logo.jpg?
When I look in my Admin section of trac, I see that I have the logo set to to root and when I look at my trac install, I have the logo located in the root of htdocs.

Great answer. Place your logo in the htdocs folder and configure your trac.ini header logo section as expressed below. site redirects to the htdocs folder and mylogo.gif is the image.
[header_logo]
src = site/mylogo.gif

Related

Apache DirectoryRoot configuration?

I have apache running on Ubuntu, my initial directory structure was like :
var/www/html/myproject,
Now I had cloned a git repository in html folder above now my directory structure becomes :
1] var/www/html/myproject this is intact,
2] var/www/html/my_repo/myproject this is newly created after cloning,
Now I want apache to deploy this newly created 2nd dir as root, hence I made the change in file located at /etc/apache2/sites-available/000-deafult.conf with following changes :
DocumentRoot var/www/html/my_repo/myproject
Then restarted the apache but somehow, server is still loading pages from var/www/html/myproject instead of var/www/html/my_repo/myproject.
So is there any extra config changes that I have missed OR Do I need some permissions to be given to cloned repository files ? How do I resolve this issue.
Did you change your original DocumentRoot in apache configuration file? If you didn't, change it, if you did, just reset browser cache by Ctrl+F5 or open page in Private Mode.
I figured it out it was /etc/apache2/sites-enabled where the seperate cofiguration file only for myproject named myproject.config in which I made following changes :
DocumentRoot var/www/html/my_repo/myproject & also
<Directory var/www/html/my_repo/myproject>
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
Now server is taking new directory as root.

Change the location of the public(www) Apache folder on debian 8

I am facing a peculiar problem with apache2 running on debian 8. I followed a couple of tutorials to install it and everything worked great. The problem is that i have partitioned the disk as 9gb for the system files, 1gb swap and 30gb for the home folder so I wanted to move the www folder from it's current location (/var/www) to home(/home/www).
I found more than a few guides on how to do that, some saying that i should change the lines in apache2.conf from this:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
to this:
<Directory /home/paul/www/>
Options Indexes FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>
As well as the documentRoot
Others suggested using the 000-default.conf file located in the /etc/apache2/sites-available folder and change the default folder from /var/www to /home/paul/www.
I did both and the folder was seen but not accessible, so i used the quick solution and use chroot 777. After that apache redirected me back to /var/www.
All settings point to /home/paul/www and the www folder has full read write permission. In fact neither the apache.conf nor 000-sites-available has any reference of /var/www so why does apache keep pointing me there? Is there something i missed?
p.s i did updates and upgrades multiple times as well as restarted the apache service and the entire pc.
you need to change the ownership of files to allow apache there
please try
chown -R www-data /home/paul/www/
however if you set a particion for your paul www why not mount the partition in /var/www
or you can create a symlink
ln -s /home/paul/www /var/www/paulsite
then edit your apache conf accordingly.
Regarding the edited file I recomend you use the 000-default better. in fact i would use that as a skeletone. and create a new file for your site then enable that site.
Ok so with a little research i realized that what i was trieing to do was not the best practice at all! (Thanx for the heads up Sudakatux).
I found the solution in askubuntu for anyone interested.
Instead of trieing to change the mechanics of apache i enabled the userdir module and set up public_html in my home folder with 755 permissions. I use a redirection script from the initial location to the various locations on my home directory. Works just fine!

File found by Django server but not by Apache/mod_wsgi

I've got a Django app which when run with "manage.py runserver 0.0.0.0:80" works fine, but when run by an Apache2 server tells me "No Such file or Directory"
I reckon it's something to do with telling Apache which path to look in, but I've done the obvious:
WSGIScriptAlias / /home/mywebsite/myproject/wsgi.py
WSGIPythonPath /home/mywebsite
<Directory /home/mywebsite/myapp>
<Files wsgi.py>
Order deny,allow
Require all granted
</Files>
</Directory>
<Directory /home/mywebsite> //I thought this might give it access to the root folder
Order deny,allow
Require all granted
</Directory>
Note my file in the root of the project, next to manage.py. The app is able to display its front page, but the ajax fired by one of the buttons fails due to the above mentioned file error.
I must be missing something about how to specify the file path.
The code to access the file is simply this:
with open('demo.txt') as fp:
etc...
To reiterate, it works fine when I just run the Django server. Apache runs the main page just fine, it only falls over when looking for this file.
What do I need to change?
One way is to set up project path in the settings file: (If it's in the project root)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
from django.conf import settings
with open(os.path.join(settings.BASE_DIR, 'demo.txt')) as fp:
...
It will be consistent across all installations of your project and you can debug BASE_DIR locally.
Try using the full path of the file, or use the os module to get the relative path.

Should I use the same folder for .htaccess and .htpasswd?

When I choose the same directory for .htaccess and .htpasswd, everything working fine.
But the situation below makes me sad.
I have one .htacces file in the root folder (johan) containing the code below.
AuthName "johan User"
AuthType Basic
AuthUserFile C:/wamp/www/johan/protectthisdir/.htpasswd
Require valid-user
.htpasswd is located at protectthisdir.
When I try to access the johan suddenly getting authentication required message box. But I need it only at protectthisdir. How to do this? Please help.
You should put the .htaccess file in the folder you want to protect, and not the root folder in your case.
The .htpasswd file should not be accessible from a browser so putting it above the DocumentRoot folder is a good idea. So in C:\wamp in your case.
PS:
It would be better to create a Virtual Host for your site to run in, in a completely different folder structure from the default wamp folders See this post for help on that

symlinks on apache (centOS)

I have a VPS for hosting sites and I'm trying to get Apache to follow symlinks but cannot figure it out. I've Googled for the past couple hours and everything seems really confusing. I don't know anything about htaccess mod_rewrite engine so that's not available.
Basically, I have a resources folder that's not in the root directory of one of the sites, it's inside another directory but I'd like a symlink in the root so that it appears to be both in the root directory AND in that other directory.
So the original is /sub/resources
and I want a symlink /resources to link to /sub/resources
Everything I try I get an Apache permission denied error. I'm creating the symlink with the root user using ln -s and setting permissions of the symlink to 755.
I've tried adding Options +FollowSymlinks to my root .htaccess file.
Also tried going to the httpd.conf file and ensuring it has
<Directory />
Options FollowSymLinks
AllowOverride Indexes
</Directory>
Very frustrating. Any suggestions?
Thanks,
Scott

Resources