I have a system with windows server 2008, Apache httpd 2.2 and trac 0.11 i'm using mod_wsgi so the apache server do the web server job.
Integration with Trac after read this site i found that the most suitable solution was
the following (i have in my httpd.conf the line Include conf/extra/httpd-trac.conf)
httpd-trac.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIDaemonProcess tracs processes=3 threads=25 maximum-requests=1000
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/trac/([^/]+)
RewriteCond c:\Project\Services\Trac\%1\conf\trac.ini !-f
RewriteRule . - [F]
RewriteCond %{REQUEST_URI} ^/trac/([^/]+)
RewriteRule . - [E=trac.env_path:c:\Project\Services\Trac\%1]
WSGIScriptAliasMatch ^/trac/([^/]+) c:\Project\Trac\trac.wsgi
<Directory c:\Project\Trac>
WSGIProcessGroup tracs
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
the problem i encouter is the following:
C:\Project\Apache\bin>httpd.exe -k start
Syntax error on line 3 of C:/Project/Apache/conf/extra/httpd-trac.conf:
Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a
module not included in the server configuration
The objective:
My objective is to have multiple trac projects with diferente authentication information.
If you have other solution than this please tell me =)
Thank you for your help.
Windows doesn't support daemon mode of mod_wsgi. Just try removing WSGIDaemonProcess/WSGIProcessGroup directives. This will result in all Trac instances running in same process. Most of the time doing that should be fine.
Related
I read a post which says Do this in the Apache config:
<VirtualHost *:80>
ServerName www.domain2.com
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3001/$1 [P,L]
ProxyPass / http://localhost:3001/
ProxyPassReverse / http://localhost:3001/
</VirtualHost>
The problem is that i am new to these things(server configuration). Can you please tell me where to find apache config and how to input these lines into it.. i have linux vps cpanel + centos6 running an apache server . because when i go to apache configuration in whm cpanel, i see global configuration,
DirectoryIndex Priority, and so on. .
Best I recommend is to ssh your Centos Server go to this default path (/etc/apache2/httpd.conf) and here you can make all possible changes .
So just ssh to server change to sudo nano /etc/apache2/httpd.conf you may use vi or gedit whatever you preferred and do the needful changes to the configuration .
For Cpanel you can do it in two ways either via WHM or with CLI
I recommend here to do with CLI :
To modify the Apache configuration's include files via the command line interface (CLI), edit the appropriate configuration files in the /usr/local/apache/conf/includes/ directory.
Afterward run service httpd/apache2 restart
You can do it by editing .htaccess file as well but again it's not the best practices to be follow.
Please let me know if you need more clear picture on this.
Canvas LMS Installation
https://github.com/instructure/canvas-lms/wiki/Production-Start
Configure Passenger with Apache
First, make sure Passenger is enabled for your Apache configuration. In Debian/Ubuntu, the libapache2-mod-passenger package should have put symlinks inside of /etc/apache2/mods-enabled/ called passenger.conf and passenger.load. If it didn't or they are disabled somehow, you can enable passenger by running:
sysadmin#appserver:/var/canvas$ sudo a2enmod passenger
In other setups, you just need to make sure you add the following lines to your Apache configuration, changing paths to appropriate values if necessary:
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
If you have trouble starting the application because of permissions problems, you might need to add this line to your passenger.conf, site configuration file, or httpd.conf (where canvasuser is the user that Canvas runs as, www-data on Debian/Ubuntu systems for example):
PassengerDefaultUser canvasuser
I don't find the httpd.conf file (Using ubuntu 16.04)
and don't understand where to put (Path of the file, Which file)
Can anyone please help me with this, What i have to do in this section?
You don't need add those lines to apache configs if you have installed libapache2-mod-passenger (Ubuntu, Debian) and executing 'sudo a2enmod passenger' was OK (no reply that module don't exist)
You need create VirtualHost with something like
<VirtualHost IP:80>
ServerName canvas.yourdomain.net
DocumentRoot /home/canvas/public
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteCond %{REQUEST_URI} !^/health_check
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
ErrorLog /var/log/virtualmin/canvas_error_log
CustomLog /var/log/virtualmin/canvas_access_log combined
SetEnv RAILS_ENV production
<Directory /home/canvas/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
I change a line in this folder etc/apache2/apache2.conf
with: AllowOverride None to AllowOverride All
and I make sure AccessFileName .htaccess is set correctly.
Then enable rewrite using this command:
sudo a2enmod rewrite
Then restart apache2:
sudo service apache2 restart
This is my simple .htaccess code:
# 1 ---- Establish a custom 404 File not Found page ----
ErrorDocument 404 /index.php
# 2 ---- Prevent directory file listing in all of your folders ----
IndexIgnore *
#block hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ style/logo/logo_icon.png [NC,R,L]
Then I get this when I access the main index.php file:
Forbidden
You don't have permission to access /index.php on this server.
Server unable to read htaccess file, denying access to be safe
Apache/2.4.12 (Ubuntu) Server at mydomain.com Port 80
The server system I am using is: Ubuntu 15.10 Server 64-Bit
I cant seem to figure out where I am going wrong, I am completely new with servers also done a good amount of research however I seem to still be limited on my abilities, I would appreciate any help :)
In my apache configuration I have a virtual host configured like this:
Alias /mediamanager /storage/files/mediamanager
<Directory /storage/files/mediamanager>
DirectoryIndex /mediaManagerIndex.php
DAV On
# ... And some authentication directives ... #
</Directory>
The idea is that someone can access the files both by a WebDAV-Client and also a simple web browser in which case some pretty directory view is generated by a PHP script.
That worked great in Apache 2.2, but recently I upgraded to Apache 2.4 and now it is broken. I highly suspect I I suffer from this bug which is already 2 years old and no fix in sight. The proposed workaround to add:
<Limit PROPFIND>
DirectoryIndex never-encounterable-file-name.html
</Limit>
Does not work for me. Probably because I still want to have a directory index. If I remove my DirectoryIndex altogether WebDAV works again (no index.html or similar files exists in this directory) but of course I loose the ability to use my PHP file as directory index. I tried to specify my DirectoryIndex in a <Limit GET> but this had no effect.
Is there any way to get both DAV and DirectoryIndex to work simultaneously in Apache 2.4 on Debian (if anyhow possible without changing the source code and recompiling)?
In order to fix this, disable directory indexing for the WebDAV site.
In your sites-available/site.conf file add DirectoryIndex disabled to the <Directory> declaration, like so:
<Directory /path/to/my/webdav/dir>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
DirectoryIndex disabled
</Directory>
Then just reload Apache and you will no longer have that issue:
sudo service apache2 reload
For me, the following configuration solved both problems:
WebDAV works again
directory indexing, if the user uses a web browser to access the repository
It works by manually implementing the directory-indexing feature with simple rewrite rules, which are applied only for the GET request method.
The following code has to be placed inside the server config or virtual host context in the apache configuration file.
# Turn off (automatic) Directory-Indexing
DirectoryIndex disabled
RewriteEngine On
# Rewrite rules for the root directory
RewriteCond "%{REQUEST_METHOD}" "(GET)"
RewriteRule "^/$" "/index.php" [L]
# Rewrite rules for other sub-directories
RewriteCond "%{REQUEST_METHOD}" "(GET)"
# The following line checks, if the index.php file exists
RewriteCond "%{DOCUMENT_ROOT}/$1/index.php" "-f"
RewriteRule "^/(.*)/$" "/$1/index.php" [L]
Don't forget to reload Apache!
This is the solution I am currently using, located in a .htaccess file at the root of the directory tree used by the WebDav service. In this case I do not use PHP, only html files, but it can be easily adapted:
# Turn off automatic directory indexing
Options -Indexes
DirectoryIndex disabled
# Redirect directory requests to index.html, only for GET requests
RewriteEngine On
RewriteCond %{REQUEST_METHOD} "GET"
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ $1index.html [L]
In order to launch always the requested PHP file, just replace "index.html" on the last line by the PHP file name:
RewriteRule ^(.*)$ $1mediaManagerIndex.php [L]
I just started learning Zend. I managed to get the basic working (using zf create project) in my local web server. Let's just say my project is called square
The only .htaccess that I have: square/public/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
httpd.conf
DocumentRoot "/home/amree/web"
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "/home/amree/web">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
NameVirtualHost square
<VirtualHost square>
DocumentRoot "/home/amree/web/square/public"
ServerName square
</VirtualHost>
hosts
127.0.0.1 square
I'm running my application on Linux.
From what I've gathered, I can open (loaded without any problems) the site using:
http://square/
http://square/default/index/index
http://192.168.1.10/square/public/
http://192.168.1.10/square/public/default/index/index
But I can't open it using:
http://square/square/public (An error occurred message from Zend)
http://192.168.1.10/square/ (got a directory listing)
I also have other web applications in the same web server. For example, the meh application can be opened using http://192.168.1.10/meh/ but cannot be opened using http://square/meh
My question is, how can I load my Zend application without getting problems to other applications in the same server? At the moment, I prefer accessing it using my local IP (192.168.1.10). It should be possible to open it from another computer in the same network.
So, in the end I should be able to load the Zend project using
http://192.168.1.10/square
http://192.168.1.10/square/public
http://192.168.1.10/square/public/default/index/index
And I can also open my other meh application using http://192.168.1.10/meh
Thanks in advance.
You can't indeed access your application using
http://square/square/public
Using the square domain will match your vhost and /square/public will be rewritten to Zend, whom will try to run Square_PublicController::indexAction()
http://192.168.1.10/square/ (got a directory listing)
you got a directoy listing (allowed by Options Indexes in <Directory "/home/amree/web">) because your .htaccess is located in http://192.168.1.10/square/public
You have to make a choice between:
http://192.168.1.10/square
http://192.168.1.10/square/public
Or maybe try an Alias in Apache
Alias /square /square/public