问题
I'm trying to get Apache on OSX 10.8.2 to proxy requests to a specific URL to a Node.js server running on port 8080 following this guide: http://garrows.com/?p=455
In order to do this, I add the following to apache2/users/george.conf:
ProxyRequests Off
ProxyPass /foo http://localhost:8080
ProxyPassReverse /foo http://localhost:8080
But with this added, apache wont start. In fact, as soon as I add even the 'ProxyRequests Off' directive, apache will no longer start. Is this the right place for this directive?
回答1:
This works for me (I use port 3000 to connect to my own server here):
<Directory "/Users/psq/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ProxyRequests Off
ProxyPass /foo http://localhost:3000
ProxyPassReverse /foo http://localhost:3000
But does not work if you place it inside <Directory>
.
To debug, you can run:
sudo apachectl configtest
This will tell you where there is an error in your config.
来源:https://stackoverflow.com/questions/15149171/configuring-apache-on-mountain-lion-proxying-to-node-js