nginx 配置web 虚拟文件夹 而且codeIgniter,thinkphp 重定向url 地址
2016-04-03 20:30
716 查看
nginx 配置虚拟文件夹而且url 重定向
当中 if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?$1 last;
break;
} i
就是对 url 重写。重写后的url 能够通过 http://127.0.0.1:8090/index.php/Page/index 訪问web 站点
server { #侦听80port listen 8090; #定义使用www.xx.com訪问 server_name 127.0.0.1; #设定本虚拟主机的訪问日志 access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /home/lxy/www/cs/; #定义服务器的默认站点根文件夹位置 #默认请求 location / { index index.php index.html index.htm; #定义首页索引文件的名称 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php? $1 last; break; } } #PHP 脚本请求所有转发到 FastCGI处理. 使用FastCGI默认配置. location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/lxy/www/cs/$fastcgi_script_name; include fastcgi_params; } #禁止訪问 .htxxx 文件 location ~ /\.ht { deny all; } }
当中 if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?$1 last;
break;
} i
就是对 url 重写。重写后的url 能够通过 http://127.0.0.1:8090/index.php/Page/index 訪问web 站点
相关文章推荐
- mac 安装 nginx 环境
- Nginx简介及配置实用
- lnmp环境下 nginx.conf的常见配置
- Nginx reload的时候出现的问题/usr/local/nginx/logs/nginx.pid
- 使用Tengine替代Nginx作为负载均衡服务器
- haproxy lvs nginx 负载均衡的比较
- nginx记录响应与POST请求日志
- nginx记录响应与POST请求日志
- nginx的通用配置
- nginx access_log 完全关闭
- nginx access_log 完全关闭
- Nginx文件类型错误解析漏洞--攻击演练
- Nginx 使用IP限制访问来源
- nginx运行时报错:error while loading shared libraries: libpcre.so.3
- Set up NginX and PHP for development on Mac OS X
- nginx的root和alias指令的区别
- Nginx配置nginx.conf的详细说明
- nginx.conf配置文件中timeout超时时间设置
- nginx 教程收集
- 赞:淘宝版的nginx