我有一个由python和tornado编写的网站。 Apache是我的网络服务器。
<VirtualHost *:80>
ServerName food.domain.com
ProxyPass / http://127.0.0.1:8004/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse / http://127.0.0.1:8004/
ProxyPreserveHost On
DocumentRoot /var/food
<Directory /var/food/ >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/php.error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
在我的网站中,static
文件以/static
开头,例如:
http://food.domain.com/static/favicon.ico
http://food.domain.com/static/upload/main/20x20_73213076755756.png
现在apache将所有网址转发给tornado
服务器。
我希望以static
开头的URL不发送到龙卷风,并且该文件由apache或其他方式重播。
什么是最佳解决方案?
答案 0 :(得分:1)
您只需使用感叹号从ProxyPass中排除该路径:
<VirtualHost *:80>
ServerName food.domain.com
DocumentRoot /var/food
ProxyPass /static !
ProxyPass / http://127.0.0.1:8004/ retry=0 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse / http://127.0.0.1:8004/
ProxyPreserveHost On
<Directory /var/food/ >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/php.error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
如果您的静力学处于/ var / food / static,则没有其他任何事情可做。