Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Wednesday, March 4, 2009

installing ikiwiki

Well, I have a machine running from a 2gb pen drive. When I wanted to install a wiki, all I saw was the size needed. (Ok, I was also interested in this when I saw it can use git -- one of my new fascination -- ). This one runs fedora 10. I followed the following steps to install it. Since it took me a while to get it working, I thought I will add it here

1. Install ikiwiki using yum (Don't remember which repo was used. I have fedora, updates and rpmfusion configured and enabled)
yum install ikiwiki

2. Add a user for this wiki
useradd wiki

3. Login as that user
su - wiki

4. Setup wiki (Catch: You need gcc for this. yum install gcc if you don't have one yet). This will ask you the folder to setup your wiki and also a user to edit wiki. Answer them with whatever folder name and username that you choose. (Rest of the article assumes that you installed it in "wiki" folder)
ikiwiki -setup /etc/ikiwiki/auto.setup
5. Configure your apache (Not needed if you have already allowed user directories and permitted executable scripts in them). This will have to be done as root

5.1 Allow user directories
Look for public_html in /etc/httpd/conf/httpd.conf. Comment "UserDir disabled" and uncomment "UserDir public_html"
5.2 Allow executable files in them

Add the following to your httpd.conf


Options ExecCGI
AddHandler cgi-script cgi pl


Do not use a SetHandler. It will result in errors from httpd (When you open the directory, it will try to execute the directory itself and fail)
5.3 Save your configuration and restart httpd

service httpd restart
6. Make changes to your wiki directories (Access control changes). This will have to be done as wiki user

6.1 Make your public_html accessible to other

chmod 711 ~
chmod 755 public_html


6.2 ikiwiki does not set certain permissions correctly and it leaves the cgi file suid. Take care of them

chmod g-w public_html/wiki
chmod a-s public_html/wiki/ikiwiki.cgi


6.3 You can also use some basic http authentication if you need.

Now your wiki should be ready to be used. Go to http://localhost/wiki/wiki to start using it

7. Last but not least, if you run into trouble, keep watching the httpd logs and then perform the action that caused the problem

tail -f /var/log/httpd/*


These logs are very useful and you can use them for debugging any issues regarding apache in general.

Friday, December 19, 2008

Apache virtual hosts (Done on F10)

This is about the name based virtual hosts using apache. I haven't tried ip-based virtual hosts. This is because of two reasons. (a) I do not have multiple IPs. (b) Even though it is possible to try this with private ips, it will only have only academic value and for a fact, I know that doing that will be really simple. (A simple soln: Run one apache per ip and set document root to any given directory)

To create a virtual host, go to the last line of your httpd.conf. You will see an example there. Just copy-n-paste the example and make the necessary changes. To create a virtual host, just do this much:

NameVirtualHost *:80


ServerAdmin webmaster@sarin.net.in
DocumentRoot /var/www/mydomain
ServerName mydomain.co.in
ErrorLog logs/mydomain-error_log
CustomLog logs/mydomain-access_log common


Now create the directory.
mkdir /var/www/mydomain
echo My homepage > /var/www/mydomain/index.html
Change the ownership of the directory
chown -R apache.apache /var/www/mydomain

Now, just restart httpd
service httpd restart

Note 1: You can create multiple virtual host entries by repeating ... block. (Also create directories with correct permission and restart service). "mydomain" & "mydomain.co.in" need to be replaced with your domain name.
Note 2: I have noticed that log file names cannot be same. They have to be different for different domains.