Questions tagged [virtualhost]

Questions relating to virtual hosting; that is, serving content for multiple logically-separate entities from the same machine. Usually relates to name-based virtual hosting in the web server, but can also cover other protocols such as SMTP or IMAP.

HTTP Virtual Hosting

In HTTP, virtual hosting refers to the serving of content for multiple domains from a single server. The most common form of virtual hosting is properly called "name-based virtual hosting", where the content to be shown is based on the domain name being requested. Less frequently, virtual hosting can be done by using the destination IP address to select which content to show (this is most commonly used when hosting HTTPS websites).

Guides for configuring virtual hosting in a number of common web servers include:

Mail Virtual Hosting

Mail service can also benefit from a form of virtual hosting. In this instance, the receiving SMTP server performs local delivery based on the entireity of the e-mail address (rather than just the local-part), and users login to their POP3/IMAP server using a username that includes their domain (this is usuallythe user's e-mail address) rather than a bare username, and the server looks up the login details and configuration information for the user based on that fully-qualified name. This allows multiple users with the same local-part to use the same server.

Most "integrated" mail services support this feature "by default"; that is, users always use their full e-mail address to login. However, most standalone mail servers do not support this by default and require additional configuration.

Further Reading

2749 questions
21
votes
2 answers

ServerName wildcards in Apache name-based virtual hosts?

On our LAN I've set up several 'fake' TLDs in the DNS server, with the intention of using them for Apache name-based virtual hosting. I'd like to combine this with mass-virtual-hosting (i.e. VirtualDocumentRoot) on an Ubuntu 10.04 LAMP…
Martijn Heemels
  • 7,728
  • 7
  • 40
  • 64
20
votes
3 answers

Configuring SSL With Virtual Hosts under Apache and CentOS

I've got two websites being served from a CentOS instance. One of those has SSL enabled, the other is just served on port 80. So, http://siteone.com and https://siteone.com both work fine, as does http://sitetwo.com. The issue is that…
gtcaz
  • 303
  • 1
  • 2
  • 4
18
votes
4 answers

How to create a multi-domain self-signed certificate for Apache2?

I've got a little private webserver where I have several virtualhosts. I know that it's impossible to assign a certificate to each individual virtualhost, because the server finds out which virtualhost was requested only AFTER the SSL connection has…
Vilx-
  • 843
  • 4
  • 16
  • 25
18
votes
9 answers

Nginx conflicting server name for subdomain

I currently have a vhost running on Nginx for foo.domain.com and everything works great. I created a new file for a new sub-domain I want to add called bar.domain.com. I use the same settings for both. When I restart Nginx I get Restarting nginx:…
JakeCowton
  • 283
  • 1
  • 2
  • 7
17
votes
8 answers

"Catch-All" access log with Apache Virtual Hosts?

I have many virtual hosts set up on a web server, each one having its own error and access log. The relevant lines of httpd.conf are something like this: ErrorLog /var/log/httpd-error.log LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"…
pix0r
  • 291
  • 1
  • 2
  • 6
16
votes
6 answers

Apache - listen only on specific domain, not IP

How can I configure apache so that it refuses connections coming directly to the IP address (http://xxx.xxx.xxx.xxx) instead of the vhost name http://example.com? My VirtualHost configuration: ServerName example.com
Alex
  • 322
  • 1
  • 4
  • 12
16
votes
2 answers

Multiple SSL vhosts using wildcard certificate in nginx

I have two hostnames sharing the same domain name which I want to serve over HTTPs. I've got a wildcard-SSL certificate and created two vhost configs: Host A listen 127.0.0.1:443 ssl; server_name a.example.com; root …
user99559
15
votes
2 answers

How can I configure VirtualHost without restarting Apache web server?

I have mentioned here apache web server because i am using that one.
Sadat
  • 253
  • 1
  • 2
  • 6
15
votes
3 answers

Is it possible to set an SSLProtocol in Apache for a single VirtualHost (poodle)?

I'm trying to test a patch for the poodle vulnerability that involves disabling SSLv3 on my web server. In order to test this on a non-production environment first, I'm setting the SSLProtocol on a VirtualHost for a different test server. My config…
Cory
  • 391
  • 2
  • 5
  • 10
15
votes
2 answers

Should you edit/delete the default apache site config?

I've just followed this tutorial on setting up name-based virtulization in Apache, and it worked really well. The tutorial basically got you to add a config file to sites-available called yourdomain.com, and then link it to sites-enabled. By…
Alex Coplan
  • 585
  • 1
  • 10
  • 19
14
votes
4 answers

Can I define HTTP and HTTPS in the same VirtualHost in Apache conf?

I've got quite a big VirtualHost definition which I don't want to duplicate just so the site will also run over HTTPS. Here's what I want to do: ServerName example.com SSLEngine on …
Jake
  • 619
  • 4
  • 7
  • 18
13
votes
1 answer

Domain redirects to wrong site in nginx, multiple sites in config files

I have 2 websites setup on nginx, and the correct one should load depending on which domain is accessed. For example: website1.com website2.com However, when accessing either of these domains, they both load website1.com. What's wrong with my…
Mark Gladstone
  • 155
  • 1
  • 2
  • 6
13
votes
1 answer

Location directive not working

For my NGINX server I have a virtual server set up just to dish out static content. At the moment I'm trying to set it up so that images have an expiry date. However, when I create a location directive for this, everything just results in a 404. My…
Jesse Brands
  • 233
  • 1
  • 2
  • 8
13
votes
2 answers

How do I "test" name-based virtual hosting?

Our website mysite.com is going to be hosted at a server with virtual hosting (name-based) at 10.20.30.40. However, the DNS records are currently pointing to 66.77.88.99. I want to keep those DNS records pointing to 66.77.88.99 while testing; is…
IQAndreas
  • 1,550
  • 2
  • 20
  • 39
13
votes
5 answers

Dynamic nginx domain root path based on hostname?

I am trying to setup my development nginx/PHP server with a basic master/catch-all vhost config so that I can created unlimited ___.framework.loc domains as needed. server { listen 80; index index.html index.htm index.php; #…
Xeoncross
  • 4,449
  • 12
  • 43
  • 56