W
W
webe2022-02-05 20:52:50
Nginx
webe, 2022-02-05 20:52:50

How to enable proxy on a server without a domain?

I installed bare nginx, I go to 61.61.61.61 and I see a test site from the default etc/www/html

config But how to make it so that the site in the /var/www/test1
directory opens on 61.61.61.61/test1 and on 61.61.61.61/ test2 opened a site in the directory /var/www/test2
created a new avalible+enabled config file, but nothing works, please tell me how to be?

server {
  listen 80;
  server_name _;
  location /test1 {
    root /var/www/test1;
    try_files $uri /index.html;
  }
    location /test2 {
    root /var/www/test2;
    try_files $uri /index.html;
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2022-02-05
@webe

Enter server_name 61.61.61.61;
How nginx handles requests

K
ky0, 2022-02-05
@ky0

In your configuration, if there are no other server blocks, everything will work anyway.
You just need to change this curvature:

location /test1 {
    root /var/www/test1;

location /test2 {
    root /var/www/test2;

to this:
location / {
    root /var/www;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question