Solved
I had a problem in my nginx conf file.
Code location ~* \.(?:ico|css|js|gif|jpe?g|png)$
is most specific match, so I had change the line:
location /node/
to:
location ^~ /node/
and now all is ok.
Question
Firstly, apologize for my English.
I have problem with nginx and node.js, I want to serve all files with nginx, .php files with php5-fpm and files from domain.com/node/ with node.js And my configuration do it, but I have problem with scripts in HTML documents e.g.
<script type="text/javascript" src="http://domain.com/node/socket.io/socket.io.js"></script>
show me error 404, and node.js not serve this file.
This is my configuration:
server {
server_name www.domain.com;
listen 80;
return 301 http://domain.com$request_uri;
}
server {
server_name domain.com;
listen 80;
access_log /var/log/nginx/domain_com_access_log;
error_log /var/log/nginx/domain_com_error_log;
root /home/domain_com/www;
location ~* \.(?:ico|css|js|gif|jpe?g|png)$
{
expires max;
access_log off;
log_not_found off;
}
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
location ~ cache/(.*)$
{
deny all;
}
location /node/
{
try_files $uri = 404;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:1234/;
proxy_redirect off;
}
location ~ \.php$
{
try_files $uri = 404;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm_domain_com.sock;
}
}