Answer the question
In order to leave comments, you need to log in
Why in Ngnix does the request not go to location?
There are 3 urls:
site.ru/itest/
site.ru/qtest/
site.ru/ztest/
The task is this:
site.ru/itest/ - should be proxied to 192.168.1.121
site.ru/qtest/ - should be proxied to 192.168. 1.122 site.ru/ztest/
- should be proxied to 192.168.1.123
To start the test:
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://192.168.1.121;
}
}
server {
listen 80;
server_name localhost;
location /itest {
proxy_pass http://192.168.1.121;
}
location /qtest {
proxy_pass http://192.168.1.122;
}
location /ztest {
proxy_pass http://192.168.1.123;
}
}
Answer the question
In order to leave comments, you need to log in
Solution:
In the /game/public folder, it was necessary to create a deberc folder
As they like to say in the nginx mailing list - show the whole config. What is written should work.
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}
server {
listen 80;
server_name localhost;
location /itest {
proxy_pass http://192.168.1.121;
}
location /qtest {
proxy_pass http://192.168.1.122;
}
location /ztest {
proxy_pass http://192.168.1.123;
}
}
nginx config on virtual server doesn't get into location /deberc
server {
listen 80;
server_name 192.168.1.121;
charset utf8;
error_log /game/nginx/log/error.log;
access_log /game/nginx/log/access.log main;
#root /game/public;
location /deberc {
root /game/public;
index index.html index.htm;
}
location / {
root /game/public;
index index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /game/public;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question