簡體   English   中英

如何配置Nginx代理通過

[英]How to configure nginx proxy pass

我正在嘗試啟動我的nginx服務器而且我正在接受

nginx:在/etc/nginx/domains.d/spreeapp.conf:52上的“<192.168.0.1>”上游找不到[emerg]主機

我的nginx.conf

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
worker_connections  1024;
}


http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

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  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/domains.d/*.conf;
}

spreeapp.conf

server {
listen       80;
server_name  _;
client_max_body_size 4M;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
    deny  all;
}

location ~ /(media|static|dl) {
    root   /var/www/vhosts/tree/content/;
}

location ~ ^/([^/]+\.[^/]+)$ {
    root   /var/www/vhosts/tree/content;
}

location / {
    uwsgi_pass   unix:///tmp/spreeapp.sock;
    include        uwsgi_params;
    uwsgi_param UWSGI_CHDIR /var/www/vhosts/tree;
    uwsgi_param UWSGI_FILE dispatch.wsgi;
    uwsgi_read_timeout 300;
    uwsgi_send_timeout 120;
    root   /var/www/vhosts/tree;
}

location = /favicon.ico {
    return 204;
    }
}

server {
listen       2080;

location  /media/ {
    root   /var/www/vhosts/tree/content;
}

location / {
    access_log  /var/log/nginx/remote.log  main;
    proxy_pass http://<192.168.43.1>:80/app/remote/;
    }
}

我試着將解析器放在下面沒有運氣

location / {
    resolver 8.8.8.8;
    access_log  /var/log/nginx/remote.log  main;
    proxy_pass http://<192.168.0.1>:80/app/remote/;
    }
}

歡迎任何指針

上述配置的問題是它無法連接到主機或URL。

嘗試這個

location / {
    access_log  /var/log/nginx/remote.log  main;
    proxy_pass http://192.168.43.1:80/app/remote/;
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM