我正在尝试迁移我的NodeJS应用程序,该应用程序从运行Nginx的专用服务器运行到另一个正在运行的Apache2。
这是我的Nginx配置文件
server {
listen 80;
server_name example.com;
root /home/user/myapp;
location / {
proxy_pass http://example.com:9000;
}
location /logs {
autoindex on;
}
}
这是我的Apache2配置文件
<VirtualHost *:80>
DocumentRoot /home/user/myapp
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://example.com:9000/
ProxyPassReverse http://example.com:9000/
</Location>
<Directory /home/user/myapp/logs>
Options +Indexes
</Directory>
</VirtualHost>
NodeJS应用程序可以在两个http服务器上运行,但我只能通过Nginx获取列表目录http://example.com/logs
,但不能通过NodeJS响应的Apache2获取
Cannot GET /logs/
Apache2配置文件中是否缺少某些内容?显然,每个Apache2 mod都已启用proxy_http
proxy
和autoindex
。
答案 0 :(得分:0)
添加ProxyPass /logs !
有效!
<VirtualHost *:80>
DocumentRoot /home/user/myapp
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /logs !
<Location />
ProxyPass http://example.com:9000/
ProxyPassReverse http://example.com:9000/
</Location>
<Directory /home/user/myapp/logs>
Options +Indexes
</Directory>
</VirtualHost>