# 静态资源处理
Apache URl rewrite
~~~
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://127.0.0.1:8364/$1 [QSA,P,L]
#请开启 proxy_mod proxy_http_mod request_mod
</IfModule>
~~~
Nginx URl rewrite
~~~
server
{
listen 80;
server_name wlh.tufangfa.cn;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/demoan/web;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_set_header X-Real-IP $remote_addr;#客户端IP地址
if (!-e $request_filename) {
proxy_pass http://127.0.0.1:8364;
}
}
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
access_log off;
}
~~~