B
B
Broncoopo2022-03-24 12:31:06
Apache HTTP Server
Broncoopo, 2022-03-24 12:31:06

How to make the site open by ip?

There is a server, Apache. It is necessary that when you enter the server ip in the address bar, the site located in the /tom folder opens, the folder is located at the root. The site is in this folder. Here it is necessary that when you enter the ip, the site opens. I don't understand how to do this. There is SSH and FTP access.
CentOs7

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2022-03-24
@shambler81

you don’t need to do this, because you will have a mirror of the site that will fall into the index like the main one, and for SEO it’s not good at all, rather, on the contrary, you need to glue the IP to the main site, but it’s better not to open access via IP at all.
And so a little theory
. Since the demon hangs on 1 port and 1 ip, and it can have more than 1 sites
, the question arises how the web server understands which site to give because all the input data is the same and which folder it does not know to climb into.
To do this, the web server crawls into the request of the client browser and takes the name of the site to which it applied.
and on the basis of $_SERVER['HTTP_REFERER']
looks for it in the configs, if it finds a match, it substitutes the desired config.
If not, then it falls into the Default
nginx example

listen 80 default_server;
        listen [::]:80 default_server;

that is, unparsed requests
tobish trash.
BUT
, by default, the Web server has only this trash in its configs
and often put sites in it, since it is easier to launch the site this way, it is immediately available after installing the web server.
In this case, it will be available on any IP domain, and so on, everything that comes to this server will climb on it.
And so you already have 1 option, go into the default config settings and set root there to / tom by
restarting Apache.
2. You can explicitly specify the IP of the site instead of *
BUT if you have more than 1 such sites, then again the web server will not figure out what to do, so this number passes only 1 time.
If you have nginx then replace this line
listen 111.111.111:80;
if apache
then change accordingly here
<VirtualHost 111.111.111:82>
But it's better not to do this ;)
well, the third option is to
create a separate site instead of a domain, specify the IP if you have a web panel, this is the easiest option.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question