apache reverseproxy not working @noob

丶灬走出姿态 提交于 2019-12-12 06:12:35

问题


I'm kinda new to server deployment stuff, so please bear with me for this noob question. My webapp run on apache while I'm serving the static files from nginx. So far so good. I want that users should be able to access some static files by accessing the apache directly( a case for reverseproxy). Here is my apache site file.

ServerName enpass.djangoserver
DocumentRoot /srv/www/enpass

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>


<Directory /srv/www/enpass>
    Order allow,deny
    Allow from all
</Directory>

ProxyPass /nginx/ http://localhost/media/
ProxyPassReverse /nginx/ http://localhost/media/

My webapp is based on django framework. Whenever i try to access something like http://enpass.djangoserver/nginx/foo, instead of data from nginx, I get an error message from my webapp(django), that /nginx is not a defined URL. Whats wrong with my configuration files? It could be an issue with priority of URL requests, but I have no idea how to proceed. Disclaimer: I posted this question a while ago at serverfault too. So don't shoot me.


回答1:


Have you checked this?

If I am not mistaken you are trying to use Apache+nginx the wrong way. Nginx should be the first one serving requests and pass back to apache/django the non-static ones. Otherwise there is not much to gain from nginx...



来源:https://stackoverflow.com/questions/4868213/apache-reverseproxy-not-working-noob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!