手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >nginx资源定向css js路径问题
nginx资源定向css js路径问题
摘要:今天做项目,学学nginx发现还不错,速度还可以,但是CSSJS确无法使用,原来nginx配置时需要对不同类型的文件配置规则,真是很郁闷,不...

 今天做项目,学学nginx发现还不错,速度还可以,但是CSS JS确无法使用,原来nginx配置时需要对不同类型的文件配置规则,真是很郁闷,不过想想也还是很有道理。问题解决后,把配置贴上来分享。

#user nobody;

worker_processes 1;

error_log logs/error.log;

pid logs/nginx.pid;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

# '$status $body_bytes_sent "$http_referer" '

# '"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/access.log ;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 8081 default;

server_name localhost;

charset utf-8;

location / {

index index.php;

if (!-e $request_filename) {

#rewrite ^/myapp/(.*.(css|js|jpg|gif|png))$ /$1 last;

rewrite ^/(.*)$ /index.php/$1;

break;

}

}

location ~ .+.php($|/) {

set $script $uri;

set $path_info "/";

if ($uri ~ "^(.+.php)(/.+)") {

set $script $1;

set $path_info $2;

}

include fcgi.conf;

root D:Apache2.2htdocsmyblog;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php?IF_REWRITE=1;

fastcgi_param PATH_INFO $path_info;

fastcgi_param SCRIPT_FILENAME $document_root/$script;

fastcgi_param SCRIPT_NAME $script;

}

location ~* .(jpg|gif|png|js|css)$ {

root D:Apache2.2htdocsmyblog;

if (-f $request_filename) {

expires max;

break;

}

}

}

}

【nginx资源定向css js路径问题】相关文章:

margin 负值引起的层级(z-index)问题

css中input标签与图片按钮对不齐怎么办

IE6下图片下方有空间距的多种解决方法

14个常见的CSS技巧及常见问题

FireFox浏览器和IE浏览器下CSS的兼容问题

使用css3制作登录表单的步骤

常用的CSS缩写语法小结可帮助你减少CSS文件大小

firefox不显示border通过清除float便可解决

css里no-repeat熟悉后面的数字是什么意思?

鼠标经过背景变色之CSS+DIV方法

精品推荐
分类导航