我必须使用像http://test1domain.com/directory这样的url来运行nodejs应用程序:
https://test1domain.com ==现场网站
https://test1domain.com/api1 == nodejs api
https://test1domain.com/api2 == nodejs api
目前的网站和应用程序运行如下:
https://test1domain.com ==现场网站
https://test1domain.com:8443 api1 == nodejs api
https://test1domain.com:3000 api2 == nodejs api
请指教,这有可能吗?
我通过编辑vi / etc / nginx / sites-enabled / default来完成
location /api2/ { proxy_pass http://0.0.0.0:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; rewrite ^/api2/(.*) /$1 break; } location /api1/ { proxy_pass http://0.0.0.0:8443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; rewrite ^/api1/(.*) /$1 break; }
它的工作!