Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

apache2 - Apache Port Proxy

I have a non-Apache server listening to port 8001 and Apache listening port 80. I want a certain virtual domain to actually be served by the non-Apache server over port 80.

Example:

<VirtualHost *:80>
  Servername example.com

  # Forward this on to the server on port 8001
</VirtualHost>

I thought I could do this with mod_proxy and ProxyPass with something like this.

ProxyPass * http://www.example.com:8001/

But that doesn't work.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

ProxyPass * http://www.example.com:8001/

star is only valid in a block. Forward slash is what you want.

ProxyPass / http://www.example.com:8001/
ProxyPassReverse / http://www.example.com:8001/

The reverse proxy ensures that redirects sent by your port 8001 server are adjusted to the canonical name name of your proxy.

The apache manual has some examples. http://httpd.apache.org/docs/2.0/mod/mod_proxy.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...