I have a problem about configuring apache for my installed Redmine.
I've installed Redmine (v 1.2.1) in /usr/local/lib/ directory successfully and it works. I want to configure apache so that Redmine would be accessible through http://myhost/redmine while I've installed a wordpress-based website in /var/www binded to http://myhost/. What should I do?
Here my current apache configuration (/etc/apache2/sites-enabled/001-redmine):
<VirtualHost *:80>
ServerName myhost
DocumentRoot /usr/local/lib/redmine-1.2.1/public
ServerSignature off
<Directory />
Order Deny,Allow
Deny from all
</Directory>
<Directory /usr/local/lib/redmine-1.2.1/public>
AllowOverride None
Order allow,deny
Allow from all
Options Indexes ExecCGI FollowSymLinks
Options -MultiViews
</Directory>
ErrorLog /var/log/apache2/redmine-error.log
CustomLog /var/log/apache2/redmine-access.log combined
</VirtualHost>
Thanks.
You can also follow the FAQ from the Redmine site: http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_a_sub-URI
I used Phusion Passenger for the Ruby plugin. I then symlinked the public folder to /var/www/redmine.
My Apache config has:
RailsBaseURI /redmine
<Directory /var/www/redmine>
Options -MultiViews
</Directory>
I had the same problem a while ago and kept some notes. According to what I figured out then, hiding the Redmine Mongrel behind the myhost/redmine dir is not entirely possible. True, Apache can act as a gateway by setting it up the following way:
ProxyPass /redmine/ http://myhost:4000/
ProxyPassReverse /redmine http://myhost:4000
ProxyPreserveHost on
But this would only work if the HTML returned by Redmine contained relative paths and not a single absolute path. Suppose a Redmine page /dir1/whatever.html references a CSS file /resources/styles.css. The client sees the HTML page as /redmine/dir1/whatever.html. If the CSS reference is relative, the client requests /redmine/css/styles.css, and Apache will forward it to the proxy as /css/styles.css. If the reference is absolute, though, the client asks for /css/styles.css, and Apache will not actas a proxy for that one. End of story.
NB: There is a third party module mod_proxy_html which parses the HTML and rewrites the references. But it will not be present on most servers.
The solution, it seemed, was to 301-redirect any requests within the /redmine dir explicitly to the Mongrel at http://myhost:4000 (should be possible with mod_rewrite).
Related
CONTEXT. I work on a server running Centos 8.3 with Apache 2.4.37.
In Apache's vhosts.conf configuration file I have this vhost for one of my websites:
<VirtualHost *:80>
ServerAdmin se#site.com
DocumentRoot /var/www/html/site
ServerName site.com
ErrorLog /var/log/httpd/admin-site.com-error_log
CustomLog /var/log/httpd/admin-site.com-access_log common
<Directory "/var/www/html/site">
Options SymLinksIfOwnerMatch
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
<Files ~ "test\.txt">
Order Allow,Deny
Deny from all
</Files>
<FilesMatch "\.(txt|png)$">
Order Allow,Deny
Deny from all
</FilesMatch>
</VirtualHost>
I have these two different scenarios:
If in the DocumentRoot folder I put only static files (html, css, images, etc), the Files and FilesMatch directives work perfectly and the frontend looks excellent.
If I put a Ghost installation in the DocumentRoot folder, I necessarily have to add the following Proxy directives to the vhost. And when doing so, the frontend looks great too, but the Files and FilesMatch directives NOT work at all, i.e. the browser allows me to open site.com/test.txt and site.com /file.png, when they shouldn't open.
ProxyRequests off
ProxyPass / http://localhost:2368/
ProxyPassReverse / http://localhost:2368/
Any ideas how to get the Files and FilesMatch directives to work on my Ghost installation?
I already tried this:
For those thinking about .htaccess. If I activate AllowOverride so that the .htaccess is read: I already tried and the directives in the .htaccess don't work either.
For those thinking of Deny from all. I know Deny from all is for Apache 2.2, and for 2.4 Require all denied should be used. I have done tests and in my Apache 2.4 the Require does not work, it only works Deny from all.
On a Windows machine running XAMPP I have a folder in my web root called 'static'. It and everything in it return a 404 error even though the folder is there.
If I change the name of the folder, e.g. 'statics', all is well. I have other servers (Ubuntu) running Apache and I do not have this problem.
The site is a copy of one of the sites on one of our Linux servers. What can I do or change to allow the directory to work as named?
EDIT vhosts.conf
<VirtualHost *:8080>
ServerAdmin jablanchard#foo.com
DocumentRoot "C:/xampp/htdocs/home/app/gateway"
ServerName localhost
ServerAlias 127.0.0.*
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
<Directory C:/xampp/htdocs/home/app/gateway/>
# allow .htaccess overrides to work
AllowOverride All
DirectoryIndex login.html index.html index.php
</Directory>
# this matches a link to any project directory to the physical webui directory
AliasMatch ^/projects/([-\w]*)/(.*)$ /home/src/gateway/webui/$2
<Directory /home/src/gateway/webui>
DirectoryIndex home.html
Options All
AllowOverride All
Require all granted
</Directory>
I was getting ready to re-install XAMPP but made one last pass through the config files for Apache. I found the problem was this bit of code in the httpd.conf file -
Alias "/static" "C:/xampp/htdocs/static"
<Directory "C:/xampp/htdocs/static">
AllowOverride All
Require all granted
</Directory>
I am not sure if this is part of the XAMPP install as all of the edits I have made to this installation are in the vhosts file. Once commented out the static directory, as I have defined it, works properly now.
I am running PHP at the server using apache web-server.
My website is running nice.
Now i need to run python on my web-server without affecting PHP in anyway.
I used the following link to configure mod_wsgi in httpd.conf under apche after installing mode_wsgi.
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
The configuration I updated is as follows:
<VirtualHost *:80>
ServerName www.quipmate.com
ServerAlias quipmate.com
ServerAdmin webmaster#quipmate.com
DocumentRoot /usr/local/www/documents
Alias /robots.txt /usr/local/www/documents/robots.txt
Alias /favicon.ico /usr/local/www/documents/favicon.ico
Alias /media/ /usr/local/www/documents/media/
<Directory /usr/local/www/documents>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess quipmate.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup quipmate.com
WSGIScriptAlias / /usr/local/www/wsgi-scripts/myapp.wsgi
<Directory /usr/local/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After updating and restarting apache, I got 404 error on my index.php file in my web document root. Also it did not helped me any way with the python script which was outputed directly on the browser. Please help.
WHich is exactly what one would expect as you used WSGIScriptAlias to mount the WSGI application at the root of the web site, thus hiding everything else on the web site.
You may want to use the AddHandler and mod_rewrite solution described in the end of the section:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive
This will allow PHP files to take precedence and only fall through to the WSGI application if the request is not satisified.
I am unable to stop apache from creating directory listings when using the server IP address. I have tried editing the relevant site-available files as follows;
<VirtualHost *:80>
JkMount /* default
ServerName example.co.uk
ServerAlias www.example.co.uk
ServerAdmin me#example.co.uk
DocumentRoot /var/www/example.co.uk/public_html
ErrorLog /var/www/example.co.uk/logs/error.log
CustomLog /var/www/example.co.uk/logs/access.log combined
<Directory /var/www/example.co.uk/public_html>
Options -Indexes
</Directory>
</VirtualHost>
...but the public_html folder contents are being listed if I access the server using a url of this format;
http://192.168.1.99/example.co.uk/public_html
I have also tried to amend the apache config file at /etc/apache2/apache.conf to include the following;
<Directory />
Options -Indexes
</Directory>
..but no joy.
I am using Tomcat, and I need my WEB-INF folder to deny access. It doesn't, and so any .class files can be downloaded.
Does anyone know how I can fix this?
thanks
This sounds a little weird. Do you have an Apache HTTPD in front of an Apache Tomcat Server?
In this case the Apache HTTPD must not point to a directory where the Apache Tomcat files reside! The communication between both can be seen more as a proxy rather than a plugin.
We have some good experience using mod_proxy_ajp for this purpose. But if you are able to download .class files and (panic mode on) the web.xml (panic mode off) something is terribly wrong.
This means that it will not reach your VirtualHost settings, but default virtual host settings.
You have 2 options (at least):
1, put .htaccess file to your directory for which you want to restrict listing
2, Setup you IP based virtual host with similar settings as your name-based vhosts
You said that you put
<Directory />
Options -Indexes
</Directory>
You should have Location instead of Directory there
What if you add /* to the end?
<Directory /var/www/example.co.uk/public_html/*>
Options -Indexes
</Directory>
Update:
Or try to add the entry outside the VirtualHost directive.
I have on my machine wampp server installed that I use to run php applications.
There are many folder in the htdocs with inside my projects and I can see those in the browser at this url: localhost/folder-name/.
I'd like to see every project in a custom url like: dev.name-folder.com
With IIS is very easy to do that, can someone explain how do that with Apache, using wampp server?
Thanks.
You can change your C:\Windows\System32\drivers\etc\hosts file to map domain names like dev.name-folder.com to your local system. (Otherwise you'll have to use a DNS server).
To configure a vhost in apache create a file for each domain/project you'd like to serve:
<VirtualHost *:80>
ServerAdmin email#domain.tld
ServerName domain.tld
DocumentRoot /var/www/htdocs/domain.tld/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/htdocs/domain.tld/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
ServerName is the domain name you'd like to serve your files under. DocumentRoot must be set to the absolute path to your files (here taken from a linux system).