1

I'm trying to setup the dev environment for facebook apps and I was following official Hiroku guide for setting up everything for local development (https://devcenter.heroku.com/articles/facebook#create_an_app). I get everything, except one step :

Apache SetEnv

If you’re running your app with Apache, you can set the env vars for your local app’s VirtualHost using the SetEnv directive. For example: ...

Can anyone clarify this step, and explain what I am doing, and tell me where this VirtualHost file is, because I searched all over /opt/lampp/ folder, and there isn't one. Thanks in forward

1
  • 2
    Hey vanjadjurdjevic! It's considered a bit rude to delete your question after someone has taken the time to provide a detailed answer to it. If there's a problem with Marty's answer, please leave a comment for him; if there's a reason why you need this question to be removed, please flag for moderator attention and explain.
    – Shog9
    Mar 27, 2012 at 22:38

1 Answer 1

2

Disclaimer: I haven't read this Hiroku guide, but I have lots of normal local websites on my local Ubuntu server, which is adapted from a standard Ubuntu 10.04 LTS.

There is a directory with all the apache configuration in /etc/apache2. In this directory, there are 4 subdirectories, two for sites and two for modules; each has one for everything available, and one for just the ones that are enabled. These are named:

sites-available   sites-enabled
mods-available    mods-enabled

What you want to look in is sites-enabled. In this folder, I think there should be a default file called 000-default.

In this file, there can be a number of entries for "VirtualHost" I believe there is only one by default, that sets up the main web directory for apache. Many people just add directories under this one, and access them by adding directories to the URL. But you can add any number of virtual hosts, in any directories you want.

For example, say you have a domain called abc.com, and you want to work on it locally. You can make an alias in the hosts file of your local workstation that you use for development (that's in /etc/hosts) for abc.com (temporarily, as this will preempt the external abc.com) to redirect it to the server (either by name or IP, or using localhost if it's on the same system).

The magic happens in apache's 000-default file, where it will look for a VirtualHost called abc.com.

So, say you have a website in a directory /var/www/abc.com; then you would add something like this to the apache file:

<VirtualHost *:80>
    <Directory /var/www/abc.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    DocumentRoot /var/www/abc.com/
    ServerName abc.com
</VirtualHost>

If you want to work on a local file, and a remote file, without editing localhost, you can rename the local one to something like abc.dev, put this in localhost, and change the apache file from abc.com to abc.dev. Then it will always be available by simply entering http://abc.dev to the address bar of your browser (or just abc.dev).

If you aren't familiar with the hosts file and need help, let me know, but it's fairly straightforward, and I don't want to waste too much time with things you may already know.

I hope my explanation has been helpful, but if not, feel free to ask for elaboration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .