Answer the question
In order to leave comments, you need to log in
Why, when configuring my nginx, I don't see what I want to see?
There is a configuration, and it does not work properly - not the way I would like it. What could be the problem? I suspect that the problem lies not in nginx at all, but in my system, help me solve my question.
So here is the configuration:
server {
listen 80;
server_name 127.0.0.1;
location / {
root /var/www;
index index.html;
}
}
server {
listen 80;
server_name api.127.0.0.1;
location / {
proxy_pass http://0.0.0.0:8080;
proxy_redirect off;
}
}
eth0 Link encap:Ethernet HWaddr 00:1a:4d:91:2b:c0
inet addr:192.168.1.153 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21a:4dff:fe91:2bc0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1598553 errors:0 dropped:0 overruns:0 frame:0
TX packets:1062272 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1861495927 (1.8 GB) TX bytes:456603051 (456.6 MB)
Interrupt:41
lo Link encap:Локальная петля (Loopback)
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:19673 errors:0 dropped:0 overruns:0 frame:0
TX packets:19673 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9471669 (9.4 MB) TX bytes:9471669 (9.4 MB)
Answer the question
In order to leave comments, you need to log in
don't get what you expect. or not what you expect, what you need.
127.0.0.1 is the ip address. although this is also a loopback interface. And you are trying to make a sub-domain that uses an ip address as the domain of the top address.
I think what you need is:
nginx config:
server_name myserver;
...
server_name api.myserver;
and in /etc/hosts:
127.0.0.1 myserver
127.0.0.1 api.myserver
and then in the browser myserver or api.myserver
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question