Community site: login faq

Hello to all.

I am running in webfaction a django/apache-wsgi application. I would like to support different versions of my site based on different countries but keeeping the same domain.

What I would like to configure is

  • have only one domain i.e. www.mysite.com
  • based on ips, I want to redirect to language specific site i.e gr.mysite.com, en.mysite.com and so on

Any suggestions?

Thank you very much for your time

asked 22 Jun '12, 20:14

accept rate: 0%

You probably want mod_geoip. It's a bit of a chore to set up, but the following post should get you going in the right direction: mod_geoip installation

Hope that helps!

permanent link

answered 22 Jun '12, 21:09

accept rate: 37%

@seanf Thank you for your immediate response! I can give it a try, but it seems a little bit advanced for me :) Before start configuring what you proposed, can I ask you something more?

What I am trying to achieve is not possible by just editing my .htaccess file? I found this article but I am not sure if fits on what I want

(23 Jun '12, 13:15) alex_wf

That looks like it could work for you. You would have to have a RewriteRule for each RewriteCond that matches. One drawback that I see from that is that you would have to have many RewriteRule/Cond statements and would have to know what IP addresses are assigned to what country. Another issue that could come up would be that a German speaking person accesses your site from an English speaking country, but can not get to the German version because of these rules. In a case like that, it might be best to put a country flag at the top of the page to allow the person to select the language they prefer. This is pretty much a standard way of having a multi-lingual site.

(23 Jun '12, 13:54) bmeyer71 ♦♦

Thank you very much for the answer. Wouldn't I have the same problem you just described (about a german speaking person living in an english speaking country) if I use mod_geoip installation?

(23 Jun '12, 14:27) alex_wf

I would assume so yes. That is why I mentioned that you might want to consider using the country flags to specify the language and let the visitor make the choice.

(23 Jun '12, 14:33) bmeyer71 ♦♦

Wow! Your feedback is really fast! Thanks. I think I would like to go with the first option that seanf suggested, which is mod_geoip installation. But since I am a beginner, can you just give me some tips?

  • Do I need to create a new application (and what typo of application) in the webfaction control panel?

  • I found some ducumentation here but I would really appreciate, if you can, to give me some basic instructions/steps. I mean, what should be the basic steps?

(23 Jun '12, 14:54) alex_wf

Yes, you'll want to get rid of your Django application and install everything from source:

  • Apache
  • mod_wsgi
  • GeoIP
  • mod_geoip
  • Django

A guide for installing Apache+mod_wsgi is available here. Installing mod_wsgi will give you apxs which you can use to compile Apache modules. The mod_geoip module assumes you are already familiar with this and the documentation for it is available in the Apache documentation. Before actually building mod_geoip, you will want to install the GeoIP C library into your home directory. The official website is here but you will need to install it as per our home-install guide as the above documentation does not apply to userspace installs. Once mod_geoip is installed, you then edit your httpd.conf file for Apache and add the appropriate LoadModule Directives and restart apache (with apachectl restart). Then you can proceed to get the Django python package and install it.

(23 Jun '12, 19:28) ryans ♦♦

Hello again and thanx for the reply. I have one more (probably naive) question.

Why do I need to install again Django? According to my understanding, I will add one more application (geoip) that will receive calls from clients and will redirect to the right applications (django apps, already installed and working for specific urls).

I understand that I will need to install apache, mod_wsgi, GeoIP and mod_geoip but why django?

(24 Jun '12, 11:40) alex_wf

I think Ryan was mentioning to reinstall django under the new application along with the rest of the packages just to keep everything together. Also the apache instance that is installed with the django app when installed from the Control Panel is no longer needed. So you would have to disable it anyway.

That said, as long as you disable the apache instance that was installed with your django app, you should be able to point to your django app's wsgi file from the httpd.conf file from your new apache install.

(24 Jun '12, 12:20) bmeyer71 ♦♦

Thanks once again for your answers.

Probably, it is because I am trying this for the first time, but I still don't understand what I need to install. Can you please explain me again what should be the installation process? As I said before, I would like to install a new application that will serve only Geoip.

  1. I have already installed a Django 1.3.1 (mod_wsgi 3.2/Python 2.6) application. This comes with some configuration and an apache. I guess I should not edit or disable anything inside there. Is this correct?

2.1 Now, I need to install a new application only to serve Geoip. Can you describe what kind of application this should be? A custom one? What I need to build from scratch there is Apache, mod_wsgi, GeoIP, mod_geoip? Something more? Something less maybe?

2.2 I still dont understand why I need to build Apache and mod_wsgi. There is not something similar already preconfigured in webfaction?

Once again thank you for your time and for your feedback. I am sure that the answer is already in what you have described me but I am a beginner :)

(24 Jun '12, 16:26) alex_wf
  1. Correct, you are going to be building, from source code, a new binary.

2.1 In the control panel it would be labeled 'Custom application listening on port'. Custom apps are how you assign the port apache listens on. Than you would be building from source Apache, mod_wsgi, GeoIP and mod_geo. Nothing less.

2.2 Because GeoIP and mod_geo require Apache's source header files to build and the 'apxs' utility which has to be built with Apache. Our provided apache stacks do not include these files, they are just binaries.

(24 Jun '12, 18:30) johns
showing 5 of 10 show 5 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 22 Jun '12, 20:14

question was seen: 2,610 times

last updated: 24 Jun '12, 18:30