upstream local {
server 127.0.0.1:81;
}
server {
listen 80;
server_name www.trololo.com;
location / {
proxy_pass http://local;
}
}
location ~ \.(jpg|png|gif) {
root /var/www/trololo.com;
}
log_format useragent '$remote_addr - [$time_local] "$host" "$request" $status ($bytes_sent) "$http_referer" '
'[$request_time] gzip:"$gzip_ratio" cache:"$upstream_cache_status" "$content_length" '
'agent:"$http_user_agent" "upstream: $upstream_addr time:$upstream_response_time sec.";
80.60.50.12 - [02/Dec/2015:16:45:34 +0300] "trololo.com" "GET /Feed/Games?lng=ru HTTP/1.1" 200 (5343) "https://trololo.com/games/" [0.019] gzip:"-" cache:"EXPIRED" "-" agent:"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0" "upstream: 127.0.0.1:80 time:0.018 sec."
GET /Feed/Games?lng=ru HTTP/1.1
был отправлен на апстрим, находящийся на адресе 127.0.0.1:80 и апстрим ответил за 0.018 секунд. А сам nginx отработал запрос за 0.019 секунд (значение в квадратных скобках).80.60.50.12 - [02/Dec/2015:16:52:21 +0300] "trololo.com" "GET /img/76.png HTTP/1.1" 200 (1870) "https://trololo.com/" [0.000] gzip:"-" cache:"-" "-" agent:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0" "upstream: - time:- sec." "UA=-"
$headers .= "Content-Type: multipart/mixed; boundary=\"" . $boundary . "\"" . $eol . $eol;
server {
listen 80;
server_name testchat.com;
index index.php;
location / {
root /var/www/chat;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ ^/nodejs/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
}
}
index index.html;
выше по уровню из локейшна в секцию server. Кстати, в location ~ \.html$ {
root html;
index index.html index.htm;
}
Cannot GET /
, то я так понял ты запрашиваешь "GET /", а он на .html не заканчивается, а значит уйдет на node.js.location ~ /js/.+\.js$ {
root html;
}
location ~ \.js$ {
root html;
try_files $uri @nodejs;
}
location @nodejs {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
}
location ~ \.(html|js)$ {