2016-04-02 119 views
1

我想開始我的nginx服務器和我越來越如何配置nginx的代理通過

nginx的:沒有發現上游[EMERG]主持人「< 192.168.0.1>」在/ etc /nginx/domains.d/spreeapp.conf:52

我的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/; 
    } 
} 

任何指針是歡迎

+0

你嘗試用proxy_pass http://192.168.0.1:80/app/remote/? – Pulkit

+0

剛剛試過並得到了> nginx:[emerg] /etc/nginx/domains.d/spreeapp.conf中的[emerg]無效URL前綴:52 nginx:配置文件/etc/nginx/nginx.conf測試失敗 – cbytes2

+0

嘗試使用http: // – Pulkit

回答

0

上述配置的問題是,它不能夠連接到主機或網址。

試試這個

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