This is going to read similar to the other Trac static resource issues I found (pretty well encompassed by this SO question), but this doesn't appear to be the same issue.
I have partial (non-root) access to a server with other Trac projects, and I have the ability to create my own Trac site. The server has the following software versions:
Python 2.7
Trac 1.0
mod_python 3.3.1
So I've created and have been using the site for a few weeks, but I can't get the logo or the favicon to show up. There is another Trac project to which I have access, and to make sure I wasn't missing anything obvious I compared the trac.ini files from both projects. The relevant sections have very similar settings, e.g.:
[header_logo]
src = site/my_logo.png
[project]
icon = site/favicon.ico
and those are both sitting in their respective Trac environments' htdocs folders:
/
opt/
trac/
trac_env_1/
htdocs/
my_logo.png
favicon.ico
trac_env_2/
htdocs/
my_logo.png
favicon.ico
However, the images only appear on one site but not the other. On my site Google Chrome says:
GET https://{Intranet URL}/trac/{my_trac_env}/chrome/site/my_logo.png 404 (Not Found)
I have tried the following, all of which have been unsuccessful:
Setting the width and height inside [header_logo] to the correct dimensions
Copying the exact same images that work on the other project over to my project
Changing site/favicon.ico to /favicon.ico and /favicon.ico? (as suggested on the Trac wiki)
Running trac-admin deploy . in place, copying the images to htdocs/common, and changing the trac.ini setting to common/my_logo.png
Changing site/my_logo.png to /images/my_logo.png and matching that folder structure in my trac environment.
Making an htdocs/site/ folder and adding the logo to it (which, I know, is what other people did wrong, but I'm banging my head against the wall here).
The only thing left I can think of is Apache settings, but from what I can tell it should handle whatever Trac environments it can find in /opt/trac. In /etc/httpd/conf.d/trac.conf, it has:
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /opt/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /var/trac/egg-cache
</Location>
That it uses TracEnvParentDir instead of just TracEnv is the important bit, I think.
So, I am at a loss. Please, can somebody help me?
Gah, I knew I was missing something simple.
The problem was file permissions. Apache did not have read access to my Trac environment, so a simple chmod -R a+rX /opt/trac/trac_env_2 solved it.
I guess that's another answer to the "My static files won't show up in Trac" question:
Don't make an actual folder named "site" in your Trac environment; site/my_logo.png will look in trac_env/htdocs
Make sure your server knows where to find your Trac environments. Both mod_python and mod_wsgi settings for this are easily found.
Make sure your server has read access to your particular Trac environment (chmod a+rX to give directories-only execute permission)
Just posting here in case anyone else runs into a similar issue.
Related
I updated my laptop from Mojave to Catalina last night, and this morning I realised that I had lost all my Apache vhosts, my vhost file was replaced with the default file.
I had all my vhosts in /usr/local/etc/httpd/extra/httpd-vhosts.conf
I would like to know which is the right way to do this (store my vhosts), so I (hopefully) won't lost my vhosts in a future update.
Thanks!!
P.D. I'm using "native" Apache, not Homebrew.
Catalina moved the root directory files as part of the upgrade. See https://apple.stackexchange.com/questions/371852/where-does-the-upgrade-to-macos-catalina-move-root-directory-files
From the answer: This took me a long time to figure out, but any file that was formerly at, e.g., /my-cool-directory was moved to /Users/Shared/Relocated Items/Security/my-cool-directory.
You might try checking in your /Users/Shared/Relocated Items/Security folder for your original Apache files.
It depends on what you do include in your httpd.conf file.
You can try use a custom created vhosts file eg. Include /private/etc/apache2/extra/mycustom-httpd-vhosts.conf next time.
After the last catalina update my custom files where not moved out of their places.
I had the same issue with updating to catalina. All my changes were gone.
By default the httpd.conf includes config files in the other directory:
Include /private/etc/apache2/other/*.conf
I place my vhosts and userdir configs in this directory now. It looks like it works just fine. Another custom file I had in there was not touched by the update.
I am having the most frustrating issue with VQmod. I moved my OpenCart store from a Godaddy VPS to Rackspace's Cloud Sites. The move went fine and everything works properly except the VQmod's on the admin panel. None of them load. No errors in the log files, no admin cache files in the cache dir, no php errors.
Things I have tried:
Cleared all cache Changed admin folder to 755
reinstalled VQmod tried both manually and using the installer with fresh index.php files
Removed all XML files and tried to load only one at a time
Cursed loudly at my computer repeatedly.
Please Help! OC version 1.5.6 VQmod 2.5.1
For those that want the solution to this, the issue was that the config.php files were both using relative paths instead of the full paths for OpenCart's various directories. They should always be full paths, or resolved with realpath() in the config.php files themselves
My case was a bit different. I checked the permissions, paths, all the regular stuff that comes to mind first. I even walked step by step through the manual installation guide.
The Opencart copy in question is shared across several environments using git. Long story short, the mods.cache and checked.cache were not added to .gitignore right away, and when I finally did that, I emptied both of them just to make sure Opencart will write new content based on my current environment. Turns out, since mods.cache was empty, Opencart believed there are no mods available.
Solution: delete both vqmod/mods.cache and vqmod/checked.cache.
Update: here are some similar issues:
https://github.com/vqmod/vqmod/issues/32
https://github.com/vqmod/vqmod/issues/3
The vqmod/vqmod/wiki/Troubleshooting guide, as of now, does not make it obvious the files should've been deleted, neither does the vqmod/vqmod/wiki/Installing-vQmod-on-OpenCart, and there doesn't seem to be any way to contirbute. vQmod fails silently, without producing any notifications, warnings, or simply detecting the issue and rebuilding the cache files. I've spent few hours trying to figure out what's wrong.
I have a project with several sub-directories. Everything works just fine, except if I try to access files inside the /root/javascript directory, I get a 404. The files do in fact exist, and I am in fact typing the path correctly. If I simply rename the directory I can then access the files. Rename it back, and I get the 404 again. VHost file works fine. No .htaccess files involved.
Apache version: 2.4.9
OS: Ubuntu 13.10
After much searching and trying different things, here's what the problem came down to:
By default, Apache 2.4 on Ubuntu enables a config file called javascript-common, which redirects any requests to files inside /javascript (that is, a directory at the root of your project called 'javascript') to /usr/share/javascript.
Solution 1
Use the following command to disable the javascript-common configuration file:
a2disconfig javascript-common
Solution 2
Add your JavaScript files inside that /usr/share/javascript directory. That way Apache will actually find those files and no 404 will be returned. One benefit of doing things this way is that you won't need multiple copies of the same files (jquery.js, etc.js) that multiple projects use...
Solution 3
Delete the directory /usr/share/javascript, and create a symbolic link that points to your project's /javascript directory. Keep in mind that if you have more than one project (vhost file), they will all serve from the same JavaScript file from the original project. In other words, this is probably not the best solution...
The a2disconfig solution didn't work for me, but then through some searching, I realized that the javascript-common is something that can be uninstalled.
So I fixed the problem by removing javascript-common:
sudo apt-get remove javascript-common
I'm not sure the point of this package, or why it would be installed automatically, but I'm glad that my javascript files are loading again!
I am running Ubuntu 14.04.1 LTS with the lamp-server bundle
Encountering the same problem, I found a similar answer resolved it.
sudo a2disconf javascript-common
sudo service apache2 restart
After the a2disconf (and note it is apparently now a2disconf and not a2disconfig)
I did get a message to execute "sudo service apache2 reload"
the reload did not resolve the issue... thus the restart
as an aside -- I cannot imagine what the developers were thinking when they loaded this little gem -- some of my javascript files might be viable across domains... but certainly not all !
You could just override /javascript alias in your .conf to reflect what you want:
Alias /javascript /my_custom_dir
I just installed a copy of Trac 1.0 using easy_install-2.6, but am having trouble deciphering the "Deploy Trac" section of the Install documentation.
After issuing easy_install-2.6 Trac=1.0, I then created my environment as so:
trac-admin /www/virtualhosts/trac initenv
Next, I set permissions:
chown -R apache.apache /www/virtualhosts/trac/
My /etc/httpd/conf.d/trac.conf file looks like this:
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
# "/www/virtualhosts/svn/trac" is the folder you gave to trac-admin initenv earlier
PythonOption TracEnv /www/virtualhosts/trac
# "/trac" is the same as the Location above
PythonOption TracUriRoot /trac
# "/tmp" should be some writable temporary directory
SetEnv PYTHON_EGG_CACHE /tmp
# "trac" can be any string, but must be the same for all
# Trac instances on the same Apache install
PythonInterpreter trac
</Location>
<Location /trac/login>
AuthType Basic
AuthName "Trac User"
AuthUserFile /www/virtualhosts/trac/conf/trac.htpasswd
Require valid-user
</Location>
I reloaded the httpd config with:
service httpd reload
Seeing no errors, I opened up the Trac installation by pointing my browser to http://my.site/trac/. The Trac application loads OK.
In the documentation, there is a section on Deploying Trac. This is where I am a little fuzzy. Is my installation of trac not already deployed? Or is this an additional step?
Second, under Mapping Static Resources, the documentation explains how to alias two directories: chrome, and site. At the beginning of the Apache ScriptAlias example the docs provide this command:
trac-admin /var/trac/env deploy /path/to/trac/htdocs/common
I do not have /var/trac/env on my system. I cannot find where this directory was created, unless it was supposed to have been set up during initial installation of Trac 1.0.
Can someone explain what needs to happen to get the chrome/site directories created? I understand these are aliased with Apache, but I'm not getting the command I quoted right above, where trac-admin uses something in /var/trac/env. That directory doesn't exist, so I am unable to issue that deploy command.
I will need the chrome/site aliases working in order to install a plugin.
For one thing, don't use mod_python. It's not being maintained any longer and it has some known issues. Setting up your server to use WSGI will give you a much better experience.
Regarding the deploy command in particular, the Trac documentation could indeed be a bit more clear. I believe both of those directory paths are just placeholders and don't have anything to do with the paths used in the documentation up to this point. They're merely there to match up with the paths used in the config file examples that follow it.
Based on the information you gave and my notes from when I set up my Trac system, try this command instead:
trac-admin /www/virtualhosts/trac deploy /www/virtualhosts/trac/deploy
That should create a deploy subdirectory in your Trac directory and populate it with "cgi-bin" and "htdocs" subfolders. From there, simply modify your Apache config files depending on what type of deployment you are doing (more details on the FastCGI and WSGI pages).
/var/trac/env was meant /path/to/trac-env, that translates in your case to /www/virtualhosts/svn/trac - the real place of your "Trac enviroment" on disc.
The deploy directive actually creates new directories and extracts static content into it, Trac's als well as Trac plugin resources as you already know. You may call it repeatedly, whenever you update trac/htdocs content. And you can even use one such trac/htdocs/common for multiple Trac envs served by the same Trac version. Just make sure to check directory permissions to ensure read access from the web-server process.
chrome/site is not a real directory at all, just a reference to directory <trac-env>/htdocs.
Still there are some plugins, that need to get unpacked to work correctly, so you'll need to setup a cache directory too.
I'm building an integrated system where I am using Trac for wiki support running on apache webserver 2.2 with mod_wsgi.
I had this idea to have a folder structure that is not \Trac\Project but something a little more complex. I want my filesystem structure to be like:
-Trac
-SomeContext
-...
-Project1
-Project2
-SomeOtherContext
-...
-Project1
-Project2
I would like to access them with the url matching their filesystem location
(ie: site.com\trac\SomeContext...\Project1)
From what i understand about trac only the folders in \Trac\ are searched with no depth other than the root.
How can i solve this problem?
See recipes in 'http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac' for ideas of how to do that.
You can apply little modification is trac source code.