Answer the question
In order to leave comments, you need to log in
Does nginx not rise, swears at proxy_pass?
Nix does not want to rise, swears at one of the domains. On all domains everything is equally registered.
nginx: [emerg] host not found in upstream "go****da.ru" in /etc/nginx/conf.d/go****da.ru:7
nginx: configuration file /etc/nginx/nginx .conf test failed
server {
listen *:80; ## listen for ipv4
server_name go****da.ru;
access_log /var/log/nginx/access.log;
# Перенаправление на back-end
location / {
proxy_pass http://go****da.ru:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
# Статическиое наполнение отдает сам nginx
# back-end этим заниматься не должен
location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|txt)$ {
root /var/www/sever/data/go****da.ru;
}
# Правила rewrite для версированного CSS + JS через дериктиву filemtime
location ~* ^.+\.(css|js)$ {
rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
# Задаем сколько будет храниться кэш
expires 31536000s;
# Выключаем логирование
access_log off;
log_not_found off;
# Добавляем заголовки (хеадеры)
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public";
}
# Агрессивное кэширование для статических файлов
location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
# Задаем сколько будет храниться кэш
expires 31536000s;
# Выключаем логирование
access_log off;
log_not_found off;
# Добавляем заголовки (хеадеры)
add_header Pragma public;
add_header Cache-Control "max-age=31536000, public";
}
}
server {
listen *:80;
server_name www.go****da.ru;
rewrite ^ http://go****da.ru$request_uri? permanent;
}
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
use epoll;
worker_connections 1024;
multi_accept on;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log off;
error_log /var/log/nginx/error.log crit;
limit_conn_zone $binary_remote_addr zone=connections:10m;
limit_conn_log_level warn;
limit_req_zone $binary_remote_addr zone=requests:10m rate=5r/s;
limit_req_log_level warn;
# Caches information about open FDs, freqently accessed files.
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
sendfile on;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 30;
keepalive_requests 100;
types_hash_max_size 1000;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_buffers 32 4k;
gzip_comp_level 9;
gzip_disable "msie6";
gzip_http_version 1.1;
gzip_static on;
gzip_vary on;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;
expires 86400s;
add_header Pragma public;
add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";
#add_header "X-UA-Compatible" "IE=Edge,chrome=1";
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
#include /usr/local/ispmgr/etc/nginx.domain;
client_max_body_size 1m;
log_format isp '$bytes_sent $request_length';
Answer the question
In order to leave comments, you need to log in
Does this domain resolve from the server? Is there a directive in the nginx config reslover
?
It is necessary to replace proxy_pass http://go****da.ru:8080/;
with proxy_pass http://127.0.0.1:8080
and it is better to make requests by the backend only on the local interface, by the way.
And also check why go****da.ru does not resolve on this machine, which is the cause of this error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question