L
L
lolrofl012021-08-02 15:26:08
Domain Name System
lolrofl01, 2021-08-02 15:26:08

How to make an additional ip the main one via ssh?

Good afternoon.
It is necessary to make the domain work on a new IP on the same server.

Ordered an additional IP. Now the domain has 2 ips, primary and secondary. It still works in the main. I didn’t find any material on the net, how to make the site work on a new IP? Found a bunch of articles but for the isp panel. I don't have isp, only ssh. How to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Drno, 2021-08-02
@Drno

so where is your domain registered - add a second IP to the DNS list

V
Viktor Taran, 2021-08-02
@shambler81

See how it works
A server can have a million IPs and they may or may not be able to access the site.
it all depends on the configs.
For example, in your config it says * in the ip from which requests are made, then by adding a new ip you will have a site working on it.
if you have explicitly specified ip in apache and nginx configs, then you will need to change them.
Here's an example of what it looks like in real life.

listen :80;
        server_name 5job.ru www.5job.ru   ;
        root /var/www/5job.ru/web;

'this one will work right away
but this one won't
listen 111.1111.111.11:80;
        server_name 5job.ru www.5job.ru   ;
        root /var/www/5job.ru/web;

You just need to set the ip in the admin panel and that's it.
Also, do not forget that if two sites hang on one IP at once, then, depending on the configuration, they will not open by IP at all, but they will work fine by domain name.
Since the web server does not require one IP per port, it perfectly parses the request headers and substitutes the site config based on the host being accessed.
Thus, any number of sites can hang on one IP.
if you say what kind of system you have debian there centos bitrix vm and so on.
Perhaps it will be possible to specify exactly where you should edit
, as the apache + nginx configuration is often used there, you will need to edit in two places at once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question