今天玩玩项目,学学nginx发现还不错,速度还可以,但是CSS JS确无法使用,原来Iginx配置时需要对不同类型的文件配置规则,真是很郁闷,不过想想也还是很有道理。闲暇之际,把配置贴上来。
#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.2\htdocs\myblog;
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.2\htdocs\myblog;
if (-f $request_filename) {
expires max;
break;
}
}
}
}
详细解决方案
nginx资源定向 css js路径有关问题
热度:104 发布时间:2012-11-16 14:12:15.0
相关解决方案
- nginx url路由~该怎么处理
- windows 上 php+nginx 并发下不去,求解决方法
- 刚配置了 centos+nginx+php 但DEDE的验证码就是无法显示解决方案
- windows 下 php+nginx 并发上不去,求解决方法
- 刚刚配置了 centos+nginx+php 但DEDE的验证码就是无法显示
- nginx url路由~解决办法
- [nginx] nginx 域名转发如何设置
- Nginx + Tomcat 服务器集群架构及调优心得小结
- nginx 502 Bad Gateway 异常解决方法
- nginx proxy_cache在windows2008上使用报错
- nginx+tomcat+memcached实现负载均衡,该怎么解决
- 在Centos+nginx+wordpress环境停启动iptables 网站返回502
- Nginx Alias 无法解析PHP的解决方法
- nginx + php 执行过程中出现404该如何解决
- nginx +php 环境筹建之php安装
- nginx 配备php环境
- php nginx 环境搭建 异常
- nginx+php5.3.20上,file_get_contents无法使用
- nginx 署理本地的html
- windows nginx +php 配备
- nginx“虚拟目录”不支持php的解决方法
- ubuntu10.04配备 nginx + php-fpm 模式
- Ubuntu上安装PHP+Nginx
- MYSQL interactive_timeout跟wait_timeout、NGINX keepalive_timeout
- linux+nginx 应用include无法包含文件?
- NGINX+PHP-金山逍遥网CMS公布系统配置
- phpmyadmin 装配 nginx 配置 cookie 配置
- Windows 上 Nginx + PHP5 的安装与配置
- 转:Windows 上 Nginx + PHP5 的安装与配置
- Nginx&&PHP-FPM配置及优化指南(下)