|
Bugzilla – Full Text Bug Listing |
| Summary: | Template for definig virtual hosts for Apache2 not completly correct. | ||
|---|---|---|---|
| Product: | [openSUSE] SUSE Linux 10.1 | Reporter: | Nils-Olov Fransson <nof> |
| Component: | Network | Assignee: | Peter Poeml <poeml> |
| Status: | RESOLVED FIXED | QA Contact: | E-mail List <qa-bugs> |
| Severity: | Enhancement | ||
| Priority: | P5 - None | CC: | suse-beta |
| Version: | Beta 2 | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | Customer | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
|
Description
Nils-Olov Fransson
2006-01-23 22:18:53 UTC
Thanks for reporting this! I can fully acknowledge what Nils-Olov says here as I had the same problem on a 9.3 installation not long ago. Seems this is done this way since then. I wanted to split up the virtual server config into one file per domain and failed because Apache only recognized the first VirtualHost and discarded the rest. Using one NameVirtualHost in each file did also not work, so finally I only could merge everything into one file and afterwards it worked perfectly. I could not find any hint how to do it with several files... looks like there is none? If there really is no way to do this, this should be made clear in the example-configuration for users who like to configure their servers manually, like me ;) I would claim it is an enhancement nontheless... For 10.1 anyway. (In reply to comment #1) > I could not find any hint how to do it with several files... looks like there > is none? This is may way to do this: First, create a file /etc/apache2/vhosts/aaaa_init_vhost.conf with the following content (one line): NameVirtualHost *:80 This makes sure that all vHosts work. (You need more lines if you want to listen on more ports of course.) Second, create a file /etc/apache2/vhosts/aaa_default_vhost.conf and put the config of your _default_ vHost into it. The conf files are included in alphabetical order, so don't use other filenames for the basic configuration. Then create /etc/apache2/vhosts/*.conf for all the other vHosts you want to run - and do not let their names start with "aaa" ;-) There is a number of ways to do it... you can also put the
NameVirtualHost statements right next to the Listen statements into
/etc/apache2/listen.conf.
To include a certain default server configuration first, one can name it
with leading underscore, or 'aaa' or similar.
The readme in the package says:
o add virtual hosts:
- edit /etc/apache2/listen.conf. It is a suitable place to add
NameVirtualHost directives.
- copy the commented template /etc/apache2/vhosts.d/vhost.template to
/etc/apache2/vhosts.d/yourhost.conf
- edit /etc/apache2/vhosts.d/yourhost.conf to suit your needs
- alternative approach: simply append the NameVirtualHost directive and the
<VirtualHost> container to your local configuration (httpd.conf.local --
see above)
- if in doubt about how apache interprets your vhost setup, always use
httpd2 -S. If SSL is involved you will need to run httpd2 -S -DSSL instead --
likewise for other needed defines.
- the "default" server, which responds to requests not handled by other
vhosts, is always the one which is defined first. If you want a dedicated
"default" server for such requests, you need to put it first in the configuration.
If the configuration is in multiple files, like /etc/apache2/vhosts.d/*.conf, then
simply name the file _default.conf, or e.g. _192.168.0.1.conf if you do it per IP
address.
Anything missing there?
I WOULD add a reference to the readme in the template now, if it didn't already contain it....
# See /usr/share/doc/packages/apache2/README.QUICKSTART for further hints
# about virtual hosts.
But I have added a note about NameVirtualHost statements.
Any further suggestions?
Christian and Peter, thanks for the verbose answears. I think that would solve this - closing it as fixed. If you have another suggestion, Nils-Olov you can still add it here. |