C
C
coderisimo2019-10-10 13:32:38
Nginx
coderisimo, 2019-10-10 13:32:38

Is it possible to tie a subdomain to Ip (without a domain)?

There is north 155.55.55.55 . There is no domain name. Reversal is simple on IP. I'm trying to create a subdomain. Made a "test" folder. It contains a project. Created a config for nginx

server {
charset utf-8;
    client_max_body_size 128M; ## listen for ipv4
    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    listen 80;

    server_name  155.55.55.55.test;
#  пробовал также и  
#  server_name  test; - рузультат тот же!
    root        /var/www/html/test/web;
    index       index.php

does not work. Nearby lies the project folder, its config is default , everything works there
listen 80;

    server_name  _;
    root        /var/www/html/project/web;
    index       index.php;

when I did a subdomain in the presence of a domain name, there were no problems.
Tell me, pliz, can this be resolved without dancing? All these server things are already over .... tired.
Thank you!
the solution that worked for me is to use different ports
listen 82;
and the second site is available at 122.122.121.12:82

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2019-10-10
@coderisimo

It is forbidden.
IPv4 is a unique 32-bit number, an IP address can be queried.
Domains, subdomains are text strings. They are transferred to some IP, to which the request is sent.
They don't mix.
To host several sites on one IP without domains, you can

  • by cookies - if available give cookies instead of site A, site B
  • A
    Alexander, 2019-10-10
    @sxq

    As you were told in the comments, you can come up with any domain name, and write a correspondence between its name and IP in your host file . Make
    server settings for this domain and when you contact you, you will be taken to the right place on the server.
    In fact, you change the DNS with the host file, the site will only open from your computer. If this domain is registered or you use an existing name, then others will be able to open your site.

    Didn't find what you were looking for?

    Ask your question

    Ask a Question

    731 491 924 answers to any question