我在端口3000上运行一个流星应用程序,并希望将代理传递给nginx,并将其传递给地址example.com/meteor。
我尝试使用以下配置,但它失败了。当我使用像meteor.example.com这样的子域名时,它正在运行。
server {
listen 80;
server_name example.com/meteor www.example.com/meteor;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000;
}
}
除此之外,我还有默认配置,如下所示:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
答案 0 :(得分:1)
您应该在更正后的服务器部分下添加/ meteor位置
server {
listen 80;
server_name example.com www.example.com;
location /meteor {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:3000;
}
#untested
location ~ /scripts/(.*)$ {
rewrite ^ /meteor/$1?$args permanent;
}
}