How to switch between two websites in a domain name?

Clash Royale CLAN TAG#URR8PPP up vote
1
down vote
favorite
I have a server running Ubuntu 16.04. When you type the domain name, for example, www.mydomainname.com it leads you to a board1. And when you type an ip address like 189.11.22.1:40443 (or domain name with the port) it leads you to another, board2.
I want to switch between these two boards: put the first board1 on ip address and the second one on the domain name.
How can I do that?
P.s. I am using nginx for configuration.
16.04 server
add a comment |Â
up vote
1
down vote
favorite
I have a server running Ubuntu 16.04. When you type the domain name, for example, www.mydomainname.com it leads you to a board1. And when you type an ip address like 189.11.22.1:40443 (or domain name with the port) it leads you to another, board2.
I want to switch between these two boards: put the first board1 on ip address and the second one on the domain name.
How can I do that?
P.s. I am using nginx for configuration.
16.04 server
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a server running Ubuntu 16.04. When you type the domain name, for example, www.mydomainname.com it leads you to a board1. And when you type an ip address like 189.11.22.1:40443 (or domain name with the port) it leads you to another, board2.
I want to switch between these two boards: put the first board1 on ip address and the second one on the domain name.
How can I do that?
P.s. I am using nginx for configuration.
16.04 server
I have a server running Ubuntu 16.04. When you type the domain name, for example, www.mydomainname.com it leads you to a board1. And when you type an ip address like 189.11.22.1:40443 (or domain name with the port) it leads you to another, board2.
I want to switch between these two boards: put the first board1 on ip address and the second one on the domain name.
How can I do that?
P.s. I am using nginx for configuration.
16.04 server
16.04 server
edited Mar 23 at 17:21
wjandrea
7,19342255
7,19342255
asked Mar 23 at 14:33
Ys3
134
134
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
With apache2 <virtualhost> directive, you can set servername, that corresponds to the domain name. So you point 2 names to same ip, and serve those from 2 virtualhosts, that are placed in different directories.
You can also specify ports to listen on virtualhost directive.
For example:
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pasiz.net
ServerAlias www.pasiz.net
DocumentRoot /var/www/www.pasiz.net/htdocs
ServerAdmin pasiz@pasiz.net
ErrorLog /var/www/www.pasiz.net/log/error.log
CustomLog /var/www/www.pasiz.net/log/access.log combined
RewriteEngine on
</VirtualHost>
</IfModule>
"Virtualhost" alias Server Block for nginx:
server
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /
try_files $uri $uri/ =404;
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
With apache2 <virtualhost> directive, you can set servername, that corresponds to the domain name. So you point 2 names to same ip, and serve those from 2 virtualhosts, that are placed in different directories.
You can also specify ports to listen on virtualhost directive.
For example:
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pasiz.net
ServerAlias www.pasiz.net
DocumentRoot /var/www/www.pasiz.net/htdocs
ServerAdmin pasiz@pasiz.net
ErrorLog /var/www/www.pasiz.net/log/error.log
CustomLog /var/www/www.pasiz.net/log/access.log combined
RewriteEngine on
</VirtualHost>
</IfModule>
"Virtualhost" alias Server Block for nginx:
server
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /
try_files $uri $uri/ =404;
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
add a comment |Â
up vote
0
down vote
accepted
With apache2 <virtualhost> directive, you can set servername, that corresponds to the domain name. So you point 2 names to same ip, and serve those from 2 virtualhosts, that are placed in different directories.
You can also specify ports to listen on virtualhost directive.
For example:
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pasiz.net
ServerAlias www.pasiz.net
DocumentRoot /var/www/www.pasiz.net/htdocs
ServerAdmin pasiz@pasiz.net
ErrorLog /var/www/www.pasiz.net/log/error.log
CustomLog /var/www/www.pasiz.net/log/access.log combined
RewriteEngine on
</VirtualHost>
</IfModule>
"Virtualhost" alias Server Block for nginx:
server
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /
try_files $uri $uri/ =404;
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
With apache2 <virtualhost> directive, you can set servername, that corresponds to the domain name. So you point 2 names to same ip, and serve those from 2 virtualhosts, that are placed in different directories.
You can also specify ports to listen on virtualhost directive.
For example:
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pasiz.net
ServerAlias www.pasiz.net
DocumentRoot /var/www/www.pasiz.net/htdocs
ServerAdmin pasiz@pasiz.net
ErrorLog /var/www/www.pasiz.net/log/error.log
CustomLog /var/www/www.pasiz.net/log/access.log combined
RewriteEngine on
</VirtualHost>
</IfModule>
"Virtualhost" alias Server Block for nginx:
server
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /
try_files $uri $uri/ =404;
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
With apache2 <virtualhost> directive, you can set servername, that corresponds to the domain name. So you point 2 names to same ip, and serve those from 2 virtualhosts, that are placed in different directories.
You can also specify ports to listen on virtualhost directive.
For example:
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName pasiz.net
ServerAlias www.pasiz.net
DocumentRoot /var/www/www.pasiz.net/htdocs
ServerAdmin pasiz@pasiz.net
ErrorLog /var/www/www.pasiz.net/log/error.log
CustomLog /var/www/www.pasiz.net/log/access.log combined
RewriteEngine on
</VirtualHost>
</IfModule>
"Virtualhost" alias Server Block for nginx:
server
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /
try_files $uri $uri/ =404;
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
edited Mar 23 at 18:33
answered Mar 23 at 17:20
Pasi Suominen
44526
44526
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1018572%2fhow-to-switch-between-two-websites-in-a-domain-name%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
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