2014-11-21 27 views
1

我想將我的NodeJS應用程序從運行Nginx的專用服務器正常工作遷移到另一個正在運行的Apache2。NodeJS與Apache和目錄列表

這裏是我的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服務器上,但我只能夠獲得上市目錄http://example.com/logs與Nginx但不與Apache2在哪裏NodeJS響應

Cannot GET /logs/ 

Apache2配置文件中缺少一些東西嗎?顯然,每個Apache2 mod都可以使用proxy_httpproxyautoindex

+0

您在nginx配置中有2個位置塊,但只有一個位於Apache配置中。 – loganfsmyth 2014-11-22 00:38:52

+0

用'Location'代替'Directory'不會改變任何'不能GET/logs /'。 – Grydz 2014-11-24 09:19:39

+0

對不起,我不是要刪除'',我的意思是添加'' – loganfsmyth 2014-11-24 16:39:23

回答

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>