Hi,
I just have set up a local test environment for static.opensuse.org. I wanted
to test, that new static content is really loaded from static.opensuse.org
without having to deploy the new content on static.opensuse.org.
It allows working with only one local checkout which simulates both checkouts
on www.opensuse.org and static.opensuse.org
Since this may be a common task for openSUSE web developers, I wrote this
mini-howto:
1.
Add static.opensuse.org to /etc/hostnames as a new alias for localhost:
127.0.0.1 localhost static.opensuse.org
Ping static.opensuse.org to verify that 127.0.0.1 is returned
2.
Create a new Apache vhost that listens on static.opensuse.org:
ServerName static.opensuse.org
DocumentRoot /srv/www/vhosts/opensuse.org
</VirtualHost>
Make sure, that the DocumentRoot points to your local website files!
3.
Add a RewriteRule if needed.
In my case, the images which were available on www.opensuse.org/images now
reside under static.opensuse.org/hosts/www.o.o/images
Since I wanted to use ONE checkout for both www.opensuse.org AND
static.opensuse.org on my machine, I needed to make sure that Apache ignores
the deeper path information (/hosts/www.o.o).
Therefore, I added a RewriteRule to the vhost:
RewriteEngine On
RewriteRule ^/hosts/www.o.o/(.*) /$1 [L]
4.
Restart the Apache webserver and you're done! Your local machine now listens
on static.opensuse.org and your Apache rewrites all requests for
/hosts/www.o.o/any_file directly to /any_file.
I thought this setup could be as useful for you as it is for me. Remember to
deactivate the vhost when you are currently not developing, since any other
content from static.opensuse.org won't load!
If you encounter any difficulties, let me know. I see if I can help.
Greets,
Andreas
--
Skype: andreas.demmer
ICQ: 103 924 771
http://www.andreas-demmer.de