Answer the question
In order to leave comments, you need to log in
Nginx as a proxy to a remote host?
Start config:
server {
listen 80;
server_name 127.0.0.1;
access_log /var/log/nginx/transition.access.log;
error_log /var/log/nginx/transition.error.log;
root /var/www/transition;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_passhttp://node
;
proxy_redirect off;
port_in_redirect off;
}
}
upstream node {
server 192.168.21.158:8090;
}
server {
listen 8090;
server_name ololo.ru
access_log /var/log/nginx/transition.access.log;
error_log /var/log/nginx/transition.error.log;
root /var/www/transition;
location / {
include mime.types;
try_files $uri $uri/ /index.html;
index index.php;
rewrite ^/login/login.php last;
rewrite ^/id /id/index.php last;
rewrite ^/uid/([a-z0-9]+)/([0-9]+)-([0-9]+)-([0-9]+)/?$ /enter.php? uid=$1&inn=$2&kpp=$3&finn=$4 last;
rewrite ^/docview/(.*)$ /docview.php?hash=$1 last;
rewrite ^/(.*)$ /index.php?url=$1&$args last;
}
location ~ \.php$ {
try_files $uri @cakephp;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/transition$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include /etc/nginx/fastcgi_params;
}
location ~* \.(js|jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv |xml|docx|xlsx|txt)$ {
root /var/www/transition;
if ($request_uri ~ "^/ajaxtemp/(.*)$") {
rewrite ^/ajaxtemp/(.*)$ /ajaxtemp/rewriter.php?filename=$1;
}
if ($request_uri ~ "^/admin/(.+)$") {
rewrite ^/admin(.*)$ /admin/app/webroot$1;
break;
}
}
}
"GET/HTTP/1.0" 499 0 "All.
Answer the question
In order to leave comments, you need to log in
If you proxy to the same host, it works. If the one specified in the config is 502.
server_name 127.0.0.1;
And the second:
"GET/HTTP/1.0" 499 0 "
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question