Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- Date: Wed, 20 Jan 2010 12:57:20 +0900
- From: Curt Sampson <cjs@example.com>
- Subject: Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- References: <4B566ABC.5000504@example.com>
- User-agent: Mutt/1.5.18 (2008-05-17)
In answer to your question, "Did Apache change everything?" the answer appears to be "no, your distro changed everything." Given that this is highly likely to change again, both within your current distro and as you move to other distros, here's my suggestion on how to configure things so that these sorts of changes cause minimal pain. What you want to do is replace the default configuration file supplied by by your distro with your own configuration file that has the bare minimum of configuration possible and does not depend on any configuration information supplied by your distro. This will not insulate you from changes (since things like the location of loadable modules can move), but it will ensure that you are not left to the whims of someone else when it comes to configuration of most of your website, and minimize the amount of work you need to do when those few things do change. After installing apache, you can find out what configuration file it's using this way. First, start it, if it's not automatically started. Then use "pgrep -lf apache" find the binary that's running, and examine the command line to see if it has "-f filename" option. If it does, that's the configuration file it's using. If not, run the binary (often /usr/sbin/apache2) with the -V option and look for the SERVER_CONFIG_FILE definition, which will give you the default config file. (In my case it's "-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf".) That's the file you want to replace. I recommend keeping your configuration file with your site, which ideally should be kept under revision control. (In particular, you must have a spare copy of the most recent version of your configuration file in case the package system modifies it.) If you do that, you can simply remove the system configuration file and replace it with a symlink to your file. Alternatively, if there are issues with that, you can just copy your configuration file over top of the system configuration file. This configuration file should be as small as possible, with just the bare minimum number of directives to get your site working properly. This will aid significantly in understanding and debugging your configuration. Comments should generally be avoided unless you're doing something especially tricky; copying the documentation from the manual into comments in your configuration file simply makes it harder to read (which, as I mentioned above, makes understanding and debugging the file more difficult). Avoid including any of the other system configuration files that the default system configuration may include; if these vanish, it can be difficult to figure out what was in them, and their contents can also change on you from time to time. For places where you need to repeatedly use information that changes from system to system (such as the user which apapache should become if started as root, the locations of modules or perhaps your document root directory), consider assigning these to variables and using those in your configuration file. I think that apache will let you do this with SetEnv and ${} syntax, such as SetEnv APACHE_LOG_DIR /var/log/apache2 ... ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined This can serve to minimize and keep together the information you need to change when your vendor moves paths around on you. > I'm going to skip past the bitching about having to learn new crap to > accomplish the same tasks... Well, I can't say it's really a fair complaint, since it was you who decided to let somebody you don't even know change your configuration any time he feels like it. Take back control of your configuration and your life will certainly be happier. cjs -- Curt Sampson <cjs@example.com> +81 90 7737 2974 http://www.starling-software.com The power of accurate observation is commonly called cynicism by those who have not got it. --George Bernard Shaw
- References:
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- Next by Date: Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- Previous by thread: Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- Next by thread: Re: [tlug] Did Apache change everything? (Setting up virtual hosts)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links