最近在用nodejs+express做服务器,用nginx做反向代理,服务器部分功能已经完成,但是nginx的反向代理一直不行。
在Linux中设置的nginx反向代理可以。设置如下:
望大神赐教。
upstream locale{
server 127.0.0.1:4990;
}
server {
server_name locale.frontend.ucloud.cn;
listen 80;
listen 443 ssl;
keepalive_timeout 75;
ssl_certificate ssl/wildcard/server.crt;
ssl_certificate_key ssl/wildcard/server.key;
location ~* /.*\.(js|gif|png|map|jpg|css|jpegcss|swf|ico|txt|html|less|jar|tpl|tgz|woff|tff|json)$ {
root /data/miedo/locale/client;
}
location / {
root /data/miedo/locale/client;
index /index.html;
try_files $uri $uri/ /index.html;
}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
}
server {
server_name locale.api.frontend.ucloud.cn;
listen 80;
listen 443 ssl;
keepalive_timeout 75;
ssl_certificate ssl/wildcard/server.crt;
ssl_certificate_key ssl/wildcard/server.key;
location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://locale;
}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
}
相关分类