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.
Related
I have found that:
When I type the following on terminal:
php -i | grep php.ini
I get the output:
The Loaded Configuration file is # /etc/php5/cli/php.ini
However, from phpinfo(), I get to see:
The loaded ini file is # /etc/php5/apache2/php.ini
Which one of these is working right now? How is it possible to have two php.ini files ?
Depends on where you are running PHP from. If you run it from command line, it uses the cli/php.ini and apache2/php.ini when run through apache.
You are executing phpinfo() through the browser, hence you get /etc/php5/apache2/php.ini as the answer. Running php -r "phpinfo();" | grep "Loaded Configuration" from the terminal should output the CLI ini. Same function, context changes.
The advantage of this system is obviously to allow different configurations depending on the context. For a simplified example, you might want to have safe_mode on in apache but it's unnecessary in CLI mode.
Your .ini paths are actually quite unusual. Normally, the default .ini is just php.ini and CLI .ini is called php-cli.ini and they reside in the same folder.
I'm no expert on the subject but this should be the basic idea. If anyone has any corrections, I'd be happy to hear them.
So I have a Laravel 5.2 project on GitHub that works perfectly on my localhost using MAMP. Now I want to deploy that project in Digital Ocean. I've used a LAMP stack and configured everything (I think). Phpmyadmin is installed as well.
I followed most of the steps highlighted in this article: http://davidmyers.name/post/laravel-on-digital-ocean but some don't apply since I think its for Laravel 4 because the Laravel 5 structure is different.
I ran composer install after cloning the repository to install the dependencies
I created the .env file to include the MySQL database info on the DO Server.
I ran the following two commands to change permissions on the project folder:
sudo chmod -R gu+w www and sudo chmod -R guo+w www
Now I am able to see the public Laravel HomePage without issues:
However, when I try to access the different API routes that have been defined in the local version I have running, I get a 404 Error on the page:
Any idea what might be causing this issue?
Thanks in Advance!
I found the answer to my issue on this thread: https://laracasts.com/discuss/channels/laravel/why-do-i-always-get-a-404-error-for-any-route-i-create?page=1
Basically I needed to modify my apache settings on the conf file. My conf file was located here: /etc/apache2/sites-available/000-default.conf
I modified that file to include this:
<Directory /var/www/yoursite.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
After I modified that, the routes now work perfectly.
Sounds like a rewrite problem. Did you setup the .htaccess files correctly in the root and in the public folder of your project?
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.
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
How to set PATH for Apache server on a per-directory basis?
Problem: I have a system in which I can not change the
system installed python in /usr/bin/.
I have a bunch of python cgi scripts that all have
#!/usr/bin/env python
as their first line. I strongly prefer not to change
these scripts for logistical reasons.
But these scripts require a different version of Python
than the system installed one. I have the right version
installed in /opt/python/bin/. So if I could put this
directory at the front of PATH, but only for this particular
cgi directory, it would solve my problem.
That is, if the following would work, it would do what I want.
ScriptAlias /mydir/cgi/ /home/me/devel/cgi/
<Directory /home/me/devel/cgi>
SetEnv PATH /opt/python/bin:/usr/bin:/bin
...other stuff...
</Directory>
But it seems SetEnv does not work on PATH (at least on Apache 2.2).
Is there some other way to changing PATH for just one
particular directory in Apache?
(P.S., I also tried SetEnvIf without any joy.)