Nginx反向代理导致图片、JS及CSS样式表无法显示问题解决
2017-02-03 13:37
1096 查看
server
{
listen 80;
#listen [::]:80;
server_name www.aa.com.ph;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.aa.com.ph;
include other.conf;
#error_page 404 /404.html;
if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
set $mobile_request '1';
}
location / {
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
location ~ .*\.(js|css)?$
{
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
expires 12h;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
expires 30d;
}
access_log /home/wwwlogs/www.aa.com.ph.log.log access;
}
{
listen 80;
#listen [::]:80;
server_name www.aa.com.ph;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.aa.com.ph;
include other.conf;
#error_page 404 /404.html;
if ($http_user_agent ~* '(Android|webOS|iPhone|iPod|BlackBerry)') {
set $mobile_request '1';
}
location / {
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "/";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
location ~ .*\.(js|css)?$
{
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
expires 12h;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
if ($mobile_request = '1') {
proxy_pass http://mobile.aa.com.ph;break; }
expires 30d;
}
access_log /home/wwwlogs/www.aa.com.ph.log.log access;
}
相关文章推荐
- nginx 反向代理转发导致css,js,图片失效
- nginx反向代理多个tomcat 配置.解决因404问题js css无法加载问题
- nginx反向代理时通过rewrite解决后端资源css/js/img 写了绝对路径的问题
- 解决nginx服务器图片(js/背景图片)不能显示问题
- Nginx反向代理端口域名无法访问问题解决
- 解决nginx无法显示图片的问题
- Nginx反向代理端口域名无法访问问题解决
- django 解决css,js文件304导致无法加载显示问题
- django 解决css,js文件304导致无法加载显示问题
- asp.net+FCKeditor上传图片显示叉叉图片无法显示的问题的解决方法
- 关于图片资源在android2.1/2.2/2.3下无法显示的问题以及解决方法
- IIS7无法显示htm/js/图片/css的问题
- 解决不同版本的eclipse或sdk所导致的android layout xml无法显示的问题
- word 2007无法显示图片的问题解决了
- 关于CSS中内层使用float导致外层的背景无法显示的问题的解决方法
- DISCUZ!7.2 [ATTACH] 标签中图片无法显示及其他一些问题的解决
- 解决IE6下无法显示png图片问题
- 关于CSS中内层使用float导致外层的背景无法显示的问题的解决
- nginx做方向代理不显示图片的问题
- 解决网通英文wiki无法显示图片问题【20100723更新】