Euro Cup about to start… Hup Holland Hup

Sports No Comments

Clean url’s in drupal

drupal No Comments

Playing with drupal today it would not allow me to enable clean url’s, which changes posts from http://anouk.dynalias.com/drupal/?q=node/1 to http://anouk.dynalias.com/drupal/node/1.  I had to do the following to allow the check of the clean url’s enabled radio button.

Edit httpd.conf, in my case /usr/local/apache2/conf/httpd.conf and add the following directory directive:

<Directory “/work/html/drupal”>
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Edit drupal’s .htaccess file, in my case /work/html/drupal/.htaccess and change the following:

# RewriteBase /

to

RewriteBase /drupal

Now go back to your drupal admin page and hopefully the radio button should be ungrayed.

Setup virtualhost in Apache on Solaris 10

apache No Comments

This one took a long time, There are loads and loads of examples out there but not all of them will work for your solution depending largely on what OS and version of Apache you are using. I am using Solaris 10 U4 and Apache 2.0.58.

You only need to amend 2 files. /etc/hosts and your Apache’s httpd.conf, which in my case is /usr/local/apache2/conf/httpd.conf.

In /etc/hosts add the ip address and fqdn of the apache2 servers. So on my host anouk, which has an ip address of 192.168.0.23 i would add the following:

192.168.0.23 anouk.dynalias.com
192.168.0.23 elthamauskick.dynalias.com

Next is the httpd.conf file. Vi and shift-g to scroll to the end of the file, which is the virtualhost section. This is what i added:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /work
</VirtualHost>

<VirtualHost *:80>
Servername anouk.dynalias.com
ServerAdmin mglas72@gmail.com
DocumentRoot /work/html
DirectoryIndex index.html index.php
Redirect /index.html http://anouk.dynalias.com/mgblog
</VirtualHost>

<VirtualHost *:80>
Servername elthamauskick.dynalias.com
ServerAdmin mglas72@gmail.com
DocumentRoot /work/html/auskick
DirectoryIndex index.html index.php
</VirtualHost>

And from here you could add as many virtualhosts as you would like. Note that inside each virtualhost you can add almost any Apache directive, but directives listed in other parts of the httpd.conf will be ignored if a virtualhost is found. The top virtualhost in the above example is used to capture any requests that fall out of the two virtualhost domains, so it displays an error message contained in /work.

With all the options available you will undoubtedly require the documentation, here is the link: http://httpd.apache.org/docs/2.0/vhosts. Google, as always, is your friend.  One last little tip, use the /usr/local/apache2/bin/httpd -S if you are having trouble, it will provide you with parsing info on the httpd.conf file.

List files out of DocumentRoot and password protect it using Apache

apache No Comments

To list the files in a directory with apache is very simple. All you have to do is add a directory alias to httpd.conf file. So if i want to add an alias called aliastest to directory /test i would add the following line:

alias /aliastest /test

Then i would go to my url:

http://myurl.com/aliastest

and i would see all files listed in /test directory (of course provided the permissions are set correctly). If i want to password protect it so that i can only see the files if i enter a username and password i add this to the directory section of httpd.conf;

<Directory “/test”>
Options Indexes MultiViews
AllowOverride AuthConfig
AuthName “test”
AuthType Basic
AuthUserFile /test/.htpasswd
AuthGroupFile /dev/null
require user test
Order allow,deny
Allow from all
</Directory>

Don’t forget to add a user;

# /usr/local/apache2/bin./htpasswd -c .htpasswd test
New password:
Re-type new password:
Adding password for user test

Then ensure the settings in the /Directory such as AuthUserfile is correct, restart apache and you’re good. There are many, many options for securing apache and this is very basic, so don’t go hiding sensitive information using this method.

« Previous Entries Next Entries »