Can a single server be associated with multiple domains?Spare PC with XP to be used as Torrent Downloader and local Web Server HOWTO?Web Server with Multiple DomainsHosting several domains on one server using IIS 7while one website host is down, can I set up another host to take over, untill the first host goes back upHow to set up multiple websites on a server with one static IP?Multiple web servers behind one public IPForward two different websites to the same serverTransferring a domain from one office portal to anotherHow to host multiple distinct web applications through a single domain, multiple URIs?Multiple servers from one host, filtering on domains and subdomains, and port translation -NGINX
GFCI versus circuit breaker
Installed software from source, how to say yum not to install it from package?
Other homotopy invariants?
beamer theme JuanLesPins
Why is my 401k manager recommending me to save more?
Non-inverting amplifier ; Single supply ; Bipolar input
How to extract coefficients of a generating function like this one, using a computer?
Why are symbols not written in words?
When does it become illegal to exchange bitcoin for cash?
How to track mail undetectably?
What prevents a US state from colonizing a smaller state?
Why are examinees often not allowed to leave during the start and end of an exam?
What do you call the fear of forgetting (specifically something one cherishes a lot)?
Are there advantages in writing by hand over typing out a story?
What is the meaning of "it" in "as luck would have it"?
Are the Gray and Death Slaad's Bite and Claw attacks magical?
Is there a connection between representation theory and PDEs?
Why should I allow multiple IP addresses on a website for a single session?
How soon after takeoff can you recline your airplane seat?
Why is quantum gravity non-renormalizable?
Available snapshots for main net?
How far can gerrymandering go?
I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again
What caused the flashes in the video footage of Chernobyl?
Can a single server be associated with multiple domains?
Spare PC with XP to be used as Torrent Downloader and local Web Server HOWTO?Web Server with Multiple DomainsHosting several domains on one server using IIS 7while one website host is down, can I set up another host to take over, untill the first host goes back upHow to set up multiple websites on a server with one static IP?Multiple web servers behind one public IPForward two different websites to the same serverTransferring a domain from one office portal to anotherHow to host multiple distinct web applications through a single domain, multiple URIs?Multiple servers from one host, filtering on domains and subdomains, and port translation -NGINX
If I own the x.x.x.x
webserver, can I make two separate sites on x.x.x.x/one
and x.x.x.x/two
and give them two different domains?
How will it handle internal links in the case (es. x.x.x.x/one/foo/page.html
)?
I'm using CentOS 7 with LAMP, and WordPress for some of the sites
webserver domain website
|
show 1 more comment
If I own the x.x.x.x
webserver, can I make two separate sites on x.x.x.x/one
and x.x.x.x/two
and give them two different domains?
How will it handle internal links in the case (es. x.x.x.x/one/foo/page.html
)?
I'm using CentOS 7 with LAMP, and WordPress for some of the sites
webserver domain website
3
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is calledNamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in theHELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.
– ivanivan
Jun 24 at 3:11
3
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
3
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14
|
show 1 more comment
If I own the x.x.x.x
webserver, can I make two separate sites on x.x.x.x/one
and x.x.x.x/two
and give them two different domains?
How will it handle internal links in the case (es. x.x.x.x/one/foo/page.html
)?
I'm using CentOS 7 with LAMP, and WordPress for some of the sites
webserver domain website
If I own the x.x.x.x
webserver, can I make two separate sites on x.x.x.x/one
and x.x.x.x/two
and give them two different domains?
How will it handle internal links in the case (es. x.x.x.x/one/foo/page.html
)?
I'm using CentOS 7 with LAMP, and WordPress for some of the sites
webserver domain website
webserver domain website
edited Jun 24 at 17:54
Kevin Panko
6,07911 gold badges36 silver badges48 bronze badges
6,07911 gold badges36 silver badges48 bronze badges
asked Jun 23 at 23:47
KodeeoKodeeo
721 silver badge5 bronze badges
721 silver badge5 bronze badges
3
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is calledNamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in theHELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.
– ivanivan
Jun 24 at 3:11
3
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
3
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14
|
show 1 more comment
3
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is calledNamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in theHELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.
– ivanivan
Jun 24 at 3:11
3
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
3
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14
3
3
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is called
NamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in the HELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.– ivanivan
Jun 24 at 3:11
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is called
NamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in the HELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.– ivanivan
Jun 24 at 3:11
3
3
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
3
3
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14
|
show 1 more comment
3 Answers
3
active
oldest
votes
Can a single server be associated with multiple domains?
Yes. This would be done by pointing those domains at your web server via DNS.
If I own the "x.x.x.x" web server, can I make two separate sites on "x.x.x.x/one" and "x.x.x.x/two" and give them two different domains?
This depends on your web server software. You could certainly point both domains to your server, but it would then be up to the server software to distinguish which traffic was intended for which domain.
Some smaller web server projects do not support this kind of feature. However, larger projects often do. In the cases of Apache and Nginx, this support comes via Name-based virtual hosts and server blocks, respectively. Both of these projects also support Server Name Indication (SNI) for TLS (HTTPS) connections as well.
How will it handle internal links in the case (es.
x.x.x.x/one/foo/page.html
)?
Typically, you would set the full path to your one
folder as the document root in e.g. your virtual host or server block configuration (i.e. where the "main" domain starts). A page that referenced e.g. example.com/foo/page.html
would then be referencing e.g. x.x.x.x/one/foo/page.html
. If you wanted to use just e.g. example.com/page.html
, you would set your document root to the full path of foo
.
WordPress
WordPress has its own methods of dealing with domains. In your example case, assuming you wanted WordPress to handle both domains, you would:
Specify two domains in DNS.
Create two e.g. virtual hosts (in Apache) corresponding to those domains.
Set each document root to point your WordPress installation.
Configure WordPress to service both those domains.
Otherwise, you would simply point one document root to your WordPress installation (and configure only one domain in WordPress) and point the other document root to your non-WordPress files.
Notes
For the explanation above, I assuming that you have your web server set up at
x.x.x.x
andone
andfoo
are directories below the default document root you have already set up for the server.It's worth mentioning that DNS points only to IP addresses (e.g.
1.2.3.4
) or, in the case of CNAME records, whole domains (e.g.example.com
). You cannot point DNS to e.g.http://1.2.3.4/one
.There are some Domain Providers that may offer web redirects (e.g. to
http://1.2.3.4/one
), but these are not part of DNS. How requests for pages would be handled in this situation would (again) entirely depend on your server.
Minimal Apache Virtual Host Examples
ex. Regular Domains
<VirtualHost *:80>
ServerName example1.com
# ServerAlias www.example1.com, *.example1.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
# ServerAlias www.example2.com, *.example2.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
ex. Sub-Domains
<VirtualHost *:80>
ServerName sub1.example.com
# ServerAlias www.sub1.example.com, *.sub1.example.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.example.com
# ServerAlias www.sub2.example2.com, *.sub2.example.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
add a comment |
It's possible, the exact configuration depending on your web server. E.g. for Apache see here.
You will need to have the DNS for both domains to point to your server's IP address -- only one of them can be set as the reverse address (IP to domain name resolution), though.
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
add a comment |
Something to keep in mind if you're using HTTPS (HTTP+TLS): There is a specific order of operations at the start of the transaction:
- The incoming connection is made using the server's IP address.
- The TLS session is negotiated.
- With TLS set up, the HTTP request is passed to the HTTP server.
If you have several DNS hostnames pointing to the same IP address, then you need to make sure that the TLS certificate for your site covers all hostnames served by your server. The client doesn't tell the server the hostname it's trying to get until the HTTP request comes through (step 3), but the client knows the desired hostname prior to step 1, and expects the server certificate sent to it in step 2 to have a matching hostname, or the browser will likely put up a "this server might be impersonated" warning screen.
This is pretty straightforward if you have a wildcard certificate and all the hostnames are in the domain covered by that certificate. It gets trickier if you need to provide a list of hostnames (a.k.a. "subject alternative names") to your certificate provider so they all get included.
There is a TLS renegotiation mechanism that might be able to serve different certificates based on hostname, prior to step 3, but it's spotty and most servers don't configure it. It's much easier to configure a web server to serve one certificate.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "3"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1452112%2fcan-a-single-server-be-associated-with-multiple-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Can a single server be associated with multiple domains?
Yes. This would be done by pointing those domains at your web server via DNS.
If I own the "x.x.x.x" web server, can I make two separate sites on "x.x.x.x/one" and "x.x.x.x/two" and give them two different domains?
This depends on your web server software. You could certainly point both domains to your server, but it would then be up to the server software to distinguish which traffic was intended for which domain.
Some smaller web server projects do not support this kind of feature. However, larger projects often do. In the cases of Apache and Nginx, this support comes via Name-based virtual hosts and server blocks, respectively. Both of these projects also support Server Name Indication (SNI) for TLS (HTTPS) connections as well.
How will it handle internal links in the case (es.
x.x.x.x/one/foo/page.html
)?
Typically, you would set the full path to your one
folder as the document root in e.g. your virtual host or server block configuration (i.e. where the "main" domain starts). A page that referenced e.g. example.com/foo/page.html
would then be referencing e.g. x.x.x.x/one/foo/page.html
. If you wanted to use just e.g. example.com/page.html
, you would set your document root to the full path of foo
.
WordPress
WordPress has its own methods of dealing with domains. In your example case, assuming you wanted WordPress to handle both domains, you would:
Specify two domains in DNS.
Create two e.g. virtual hosts (in Apache) corresponding to those domains.
Set each document root to point your WordPress installation.
Configure WordPress to service both those domains.
Otherwise, you would simply point one document root to your WordPress installation (and configure only one domain in WordPress) and point the other document root to your non-WordPress files.
Notes
For the explanation above, I assuming that you have your web server set up at
x.x.x.x
andone
andfoo
are directories below the default document root you have already set up for the server.It's worth mentioning that DNS points only to IP addresses (e.g.
1.2.3.4
) or, in the case of CNAME records, whole domains (e.g.example.com
). You cannot point DNS to e.g.http://1.2.3.4/one
.There are some Domain Providers that may offer web redirects (e.g. to
http://1.2.3.4/one
), but these are not part of DNS. How requests for pages would be handled in this situation would (again) entirely depend on your server.
Minimal Apache Virtual Host Examples
ex. Regular Domains
<VirtualHost *:80>
ServerName example1.com
# ServerAlias www.example1.com, *.example1.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
# ServerAlias www.example2.com, *.example2.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
ex. Sub-Domains
<VirtualHost *:80>
ServerName sub1.example.com
# ServerAlias www.sub1.example.com, *.sub1.example.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.example.com
# ServerAlias www.sub2.example2.com, *.sub2.example.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
add a comment |
Can a single server be associated with multiple domains?
Yes. This would be done by pointing those domains at your web server via DNS.
If I own the "x.x.x.x" web server, can I make two separate sites on "x.x.x.x/one" and "x.x.x.x/two" and give them two different domains?
This depends on your web server software. You could certainly point both domains to your server, but it would then be up to the server software to distinguish which traffic was intended for which domain.
Some smaller web server projects do not support this kind of feature. However, larger projects often do. In the cases of Apache and Nginx, this support comes via Name-based virtual hosts and server blocks, respectively. Both of these projects also support Server Name Indication (SNI) for TLS (HTTPS) connections as well.
How will it handle internal links in the case (es.
x.x.x.x/one/foo/page.html
)?
Typically, you would set the full path to your one
folder as the document root in e.g. your virtual host or server block configuration (i.e. where the "main" domain starts). A page that referenced e.g. example.com/foo/page.html
would then be referencing e.g. x.x.x.x/one/foo/page.html
. If you wanted to use just e.g. example.com/page.html
, you would set your document root to the full path of foo
.
WordPress
WordPress has its own methods of dealing with domains. In your example case, assuming you wanted WordPress to handle both domains, you would:
Specify two domains in DNS.
Create two e.g. virtual hosts (in Apache) corresponding to those domains.
Set each document root to point your WordPress installation.
Configure WordPress to service both those domains.
Otherwise, you would simply point one document root to your WordPress installation (and configure only one domain in WordPress) and point the other document root to your non-WordPress files.
Notes
For the explanation above, I assuming that you have your web server set up at
x.x.x.x
andone
andfoo
are directories below the default document root you have already set up for the server.It's worth mentioning that DNS points only to IP addresses (e.g.
1.2.3.4
) or, in the case of CNAME records, whole domains (e.g.example.com
). You cannot point DNS to e.g.http://1.2.3.4/one
.There are some Domain Providers that may offer web redirects (e.g. to
http://1.2.3.4/one
), but these are not part of DNS. How requests for pages would be handled in this situation would (again) entirely depend on your server.
Minimal Apache Virtual Host Examples
ex. Regular Domains
<VirtualHost *:80>
ServerName example1.com
# ServerAlias www.example1.com, *.example1.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
# ServerAlias www.example2.com, *.example2.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
ex. Sub-Domains
<VirtualHost *:80>
ServerName sub1.example.com
# ServerAlias www.sub1.example.com, *.sub1.example.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.example.com
# ServerAlias www.sub2.example2.com, *.sub2.example.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
add a comment |
Can a single server be associated with multiple domains?
Yes. This would be done by pointing those domains at your web server via DNS.
If I own the "x.x.x.x" web server, can I make two separate sites on "x.x.x.x/one" and "x.x.x.x/two" and give them two different domains?
This depends on your web server software. You could certainly point both domains to your server, but it would then be up to the server software to distinguish which traffic was intended for which domain.
Some smaller web server projects do not support this kind of feature. However, larger projects often do. In the cases of Apache and Nginx, this support comes via Name-based virtual hosts and server blocks, respectively. Both of these projects also support Server Name Indication (SNI) for TLS (HTTPS) connections as well.
How will it handle internal links in the case (es.
x.x.x.x/one/foo/page.html
)?
Typically, you would set the full path to your one
folder as the document root in e.g. your virtual host or server block configuration (i.e. where the "main" domain starts). A page that referenced e.g. example.com/foo/page.html
would then be referencing e.g. x.x.x.x/one/foo/page.html
. If you wanted to use just e.g. example.com/page.html
, you would set your document root to the full path of foo
.
WordPress
WordPress has its own methods of dealing with domains. In your example case, assuming you wanted WordPress to handle both domains, you would:
Specify two domains in DNS.
Create two e.g. virtual hosts (in Apache) corresponding to those domains.
Set each document root to point your WordPress installation.
Configure WordPress to service both those domains.
Otherwise, you would simply point one document root to your WordPress installation (and configure only one domain in WordPress) and point the other document root to your non-WordPress files.
Notes
For the explanation above, I assuming that you have your web server set up at
x.x.x.x
andone
andfoo
are directories below the default document root you have already set up for the server.It's worth mentioning that DNS points only to IP addresses (e.g.
1.2.3.4
) or, in the case of CNAME records, whole domains (e.g.example.com
). You cannot point DNS to e.g.http://1.2.3.4/one
.There are some Domain Providers that may offer web redirects (e.g. to
http://1.2.3.4/one
), but these are not part of DNS. How requests for pages would be handled in this situation would (again) entirely depend on your server.
Minimal Apache Virtual Host Examples
ex. Regular Domains
<VirtualHost *:80>
ServerName example1.com
# ServerAlias www.example1.com, *.example1.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
# ServerAlias www.example2.com, *.example2.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
ex. Sub-Domains
<VirtualHost *:80>
ServerName sub1.example.com
# ServerAlias www.sub1.example.com, *.sub1.example.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.example.com
# ServerAlias www.sub2.example2.com, *.sub2.example.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
Can a single server be associated with multiple domains?
Yes. This would be done by pointing those domains at your web server via DNS.
If I own the "x.x.x.x" web server, can I make two separate sites on "x.x.x.x/one" and "x.x.x.x/two" and give them two different domains?
This depends on your web server software. You could certainly point both domains to your server, but it would then be up to the server software to distinguish which traffic was intended for which domain.
Some smaller web server projects do not support this kind of feature. However, larger projects often do. In the cases of Apache and Nginx, this support comes via Name-based virtual hosts and server blocks, respectively. Both of these projects also support Server Name Indication (SNI) for TLS (HTTPS) connections as well.
How will it handle internal links in the case (es.
x.x.x.x/one/foo/page.html
)?
Typically, you would set the full path to your one
folder as the document root in e.g. your virtual host or server block configuration (i.e. where the "main" domain starts). A page that referenced e.g. example.com/foo/page.html
would then be referencing e.g. x.x.x.x/one/foo/page.html
. If you wanted to use just e.g. example.com/page.html
, you would set your document root to the full path of foo
.
WordPress
WordPress has its own methods of dealing with domains. In your example case, assuming you wanted WordPress to handle both domains, you would:
Specify two domains in DNS.
Create two e.g. virtual hosts (in Apache) corresponding to those domains.
Set each document root to point your WordPress installation.
Configure WordPress to service both those domains.
Otherwise, you would simply point one document root to your WordPress installation (and configure only one domain in WordPress) and point the other document root to your non-WordPress files.
Notes
For the explanation above, I assuming that you have your web server set up at
x.x.x.x
andone
andfoo
are directories below the default document root you have already set up for the server.It's worth mentioning that DNS points only to IP addresses (e.g.
1.2.3.4
) or, in the case of CNAME records, whole domains (e.g.example.com
). You cannot point DNS to e.g.http://1.2.3.4/one
.There are some Domain Providers that may offer web redirects (e.g. to
http://1.2.3.4/one
), but these are not part of DNS. How requests for pages would be handled in this situation would (again) entirely depend on your server.
Minimal Apache Virtual Host Examples
ex. Regular Domains
<VirtualHost *:80>
ServerName example1.com
# ServerAlias www.example1.com, *.example1.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName example2.com
# ServerAlias www.example2.com, *.example2.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
ex. Sub-Domains
<VirtualHost *:80>
ServerName sub1.example.com
# ServerAlias www.sub1.example.com, *.sub1.example.com
DocumentRoot "/path/to/www/Wordpress_Site"
</VirtualHost>
<VirtualHost *:80>
ServerName sub2.example.com
# ServerAlias www.sub2.example2.com, *.sub2.example.com
DocumentRoot "/path/to/www/Non-Wordpress_Site"
</VirtualHost>
edited Jun 24 at 8:51
answered Jun 24 at 1:30
AnaksunamanAnaksunaman
6,8812 gold badges17 silver badges26 bronze badges
6,8812 gold badges17 silver badges26 bronze badges
add a comment |
add a comment |
It's possible, the exact configuration depending on your web server. E.g. for Apache see here.
You will need to have the DNS for both domains to point to your server's IP address -- only one of them can be set as the reverse address (IP to domain name resolution), though.
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
add a comment |
It's possible, the exact configuration depending on your web server. E.g. for Apache see here.
You will need to have the DNS for both domains to point to your server's IP address -- only one of them can be set as the reverse address (IP to domain name resolution), though.
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
add a comment |
It's possible, the exact configuration depending on your web server. E.g. for Apache see here.
You will need to have the DNS for both domains to point to your server's IP address -- only one of them can be set as the reverse address (IP to domain name resolution), though.
It's possible, the exact configuration depending on your web server. E.g. for Apache see here.
You will need to have the DNS for both domains to point to your server's IP address -- only one of them can be set as the reverse address (IP to domain name resolution), though.
answered Jun 24 at 0:14
vlumivlumi
2719 bronze badges
2719 bronze badges
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
add a comment |
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
So, if I've understood from that page I can have 2 sites but one should be one.mydomain.com and the other two. mydomain.com
– Kodeeo
Jun 24 at 1:28
4
4
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
@Kodeeo They do not have to be sub-domains, but you can configure them that way, if you like.
– Anaksunaman
Jun 24 at 1:44
3
3
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
The sites can indeed anything that is associated with your IP address -- sub-domains or not.
– vlumi
Jun 24 at 2:02
add a comment |
Something to keep in mind if you're using HTTPS (HTTP+TLS): There is a specific order of operations at the start of the transaction:
- The incoming connection is made using the server's IP address.
- The TLS session is negotiated.
- With TLS set up, the HTTP request is passed to the HTTP server.
If you have several DNS hostnames pointing to the same IP address, then you need to make sure that the TLS certificate for your site covers all hostnames served by your server. The client doesn't tell the server the hostname it's trying to get until the HTTP request comes through (step 3), but the client knows the desired hostname prior to step 1, and expects the server certificate sent to it in step 2 to have a matching hostname, or the browser will likely put up a "this server might be impersonated" warning screen.
This is pretty straightforward if you have a wildcard certificate and all the hostnames are in the domain covered by that certificate. It gets trickier if you need to provide a list of hostnames (a.k.a. "subject alternative names") to your certificate provider so they all get included.
There is a TLS renegotiation mechanism that might be able to serve different certificates based on hostname, prior to step 3, but it's spotty and most servers don't configure it. It's much easier to configure a web server to serve one certificate.
add a comment |
Something to keep in mind if you're using HTTPS (HTTP+TLS): There is a specific order of operations at the start of the transaction:
- The incoming connection is made using the server's IP address.
- The TLS session is negotiated.
- With TLS set up, the HTTP request is passed to the HTTP server.
If you have several DNS hostnames pointing to the same IP address, then you need to make sure that the TLS certificate for your site covers all hostnames served by your server. The client doesn't tell the server the hostname it's trying to get until the HTTP request comes through (step 3), but the client knows the desired hostname prior to step 1, and expects the server certificate sent to it in step 2 to have a matching hostname, or the browser will likely put up a "this server might be impersonated" warning screen.
This is pretty straightforward if you have a wildcard certificate and all the hostnames are in the domain covered by that certificate. It gets trickier if you need to provide a list of hostnames (a.k.a. "subject alternative names") to your certificate provider so they all get included.
There is a TLS renegotiation mechanism that might be able to serve different certificates based on hostname, prior to step 3, but it's spotty and most servers don't configure it. It's much easier to configure a web server to serve one certificate.
add a comment |
Something to keep in mind if you're using HTTPS (HTTP+TLS): There is a specific order of operations at the start of the transaction:
- The incoming connection is made using the server's IP address.
- The TLS session is negotiated.
- With TLS set up, the HTTP request is passed to the HTTP server.
If you have several DNS hostnames pointing to the same IP address, then you need to make sure that the TLS certificate for your site covers all hostnames served by your server. The client doesn't tell the server the hostname it's trying to get until the HTTP request comes through (step 3), but the client knows the desired hostname prior to step 1, and expects the server certificate sent to it in step 2 to have a matching hostname, or the browser will likely put up a "this server might be impersonated" warning screen.
This is pretty straightforward if you have a wildcard certificate and all the hostnames are in the domain covered by that certificate. It gets trickier if you need to provide a list of hostnames (a.k.a. "subject alternative names") to your certificate provider so they all get included.
There is a TLS renegotiation mechanism that might be able to serve different certificates based on hostname, prior to step 3, but it's spotty and most servers don't configure it. It's much easier to configure a web server to serve one certificate.
Something to keep in mind if you're using HTTPS (HTTP+TLS): There is a specific order of operations at the start of the transaction:
- The incoming connection is made using the server's IP address.
- The TLS session is negotiated.
- With TLS set up, the HTTP request is passed to the HTTP server.
If you have several DNS hostnames pointing to the same IP address, then you need to make sure that the TLS certificate for your site covers all hostnames served by your server. The client doesn't tell the server the hostname it's trying to get until the HTTP request comes through (step 3), but the client knows the desired hostname prior to step 1, and expects the server certificate sent to it in step 2 to have a matching hostname, or the browser will likely put up a "this server might be impersonated" warning screen.
This is pretty straightforward if you have a wildcard certificate and all the hostnames are in the domain covered by that certificate. It gets trickier if you need to provide a list of hostnames (a.k.a. "subject alternative names") to your certificate provider so they all get included.
There is a TLS renegotiation mechanism that might be able to serve different certificates based on hostname, prior to step 3, but it's spotty and most servers don't configure it. It's much easier to configure a web server to serve one certificate.
answered Jun 25 at 4:28
Mike DeSimoneMike DeSimone
2061 silver badge4 bronze badges
2061 silver badge4 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1452112%2fcan-a-single-server-be-associated-with-multiple-domains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Few extra details for you. For a HTTP/S server only, no issues at all, you want to use what is called
NamedHosts
in Apache, nginx et al have similar tech (except maybe IIS). For SSL you need SNI support (fairly standard today). Where you will have issues is when scripts, etc. using the local mail service to send emails out (form submissions, password resets, etc). Mail can really only be configured with one name used in theHELO
portion of the transmission, and so for spam purposes all of the domains you host have to allow whatever name you select. Otherwise there will be issues.– ivanivan
Jun 24 at 3:11
3
By the way: low-budget webhosts usually host thousands of domains on the same physical server and often even on the same logical server process.
– Philipp
Jun 24 at 9:35
3
That's how Virtual Hosts work. Look in your config file. Refer to this page for more info: httpd.apache.org/docs/2.4/vhosts
– Ring
Jun 24 at 11:01
Keep in mind that while you can do this, the more stuff you're running on a single server, the larger the attack vector you expose to the world out there. More so, an attack to one domain can end up compromising the other. Keep that in mind.
– T. Sar
Jun 24 at 18:50
It's very common: en.wikipedia.org/wiki/Shared_web_hosting_service
– Thomas
Jun 25 at 9:14