在与我的wordpress WEB-SERVER NGINX相同的域中提供nodejs静态文件

时间:2017-01-19 18:17:44

标签: php node.js wordpress nginx

server {
listen 80;
listen [::]:80;
servername www.domain.com.br;
return 301 http://www.domain.com.br$requesturi;

root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

location ~ /\.ht {
deny all;
}

location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all;}
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location /sistema/ { //RUNNING NODEJS RIGHT HERE
proxy_read_timeout 600;
client_max_body_size       500M;
proxy_pass http://localhost:8080;
proxy_set_header Host      $host;
proxy_set_header X-Real-IP $remote_addr;

}
}

我想通过

从我的NODEJS系统提供我的静态文件或上传的文件

www.mydomain.com.br/sistema/uploads/path/tofile

www.mydomain.com.br/sistema/views/path/to/views

我正在使用express.static(__ dirname +'/ public');作为静态文件夹;

有可能吗?我一直试图设置我的服务器块,但是我使用上面的url获得404 nginx。

谢谢,

Enrico Alvarenga

0 个答案:

没有答案