之前一直使用apache 服务器,现有一项目想转到Nginx 服务器运行。。

发现Apache 的撰写功能和 Nginx的不一样。无法通用.hataccess 文件

查阅网上资料,nginx 配置转写功能 是直接在配置文件中 配置的:

虚拟服务器设置:

server {
listen ; server_name localhost:; root "D:/phpStudy/WWW/yii2/anran/backend/web"; location / {
index index.html index.php;#默认主页
autoindex on;#是否允许访问目录
include D:/phpStudy/WWW/yii2/anran/backend/web/.htaccess; #关键htaccess 导入
}
#php 解析器
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
} }

其中

include D:/phpStudy/WWW/yii2/anran/backend/web/.htaccess; #关键htaccess 导入

是由apache 的.htaccess 转化过来的 网址:http://winginx.com/en/htaccess

原.htaccess 

Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

转换后.htaccess (就是nginx导入的配置)

if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}

Nginx 转写功能和Apache .htaccess 对应的更多相关文章

  1. Apache .htaccess文件

    今天在将ThinkPHP的URL模式由普通模式(URL_MODE=1)http://localhost/mythinkphp/index.php/Index/user/id/1.html改为重写模式 ...

  2. 为什么Nginx的性能要比Apache高很多?

    为什么Nginx的性能要比Apache高很多? 这得益于Nginx使用了最新的epoll(Linux 2.6内核)和kqueue(freebsd)网络I/O模型,而Apache则使用的是传统的sele ...

  3. Nginx启动SSL功能

    Nginx启动SSL功能,并进行功能优化,你看这个就足够了 一:开始Nginx的SSL模块 1.1 Nginx如果未开启SSL模块,配置Https时提示错误 nginx: [emerg] the &q ...

  4. Nginx代理缓存功能

    Nginx代理缓存功能      Nginx缓存主要是用于减轻后端服务器的负载,提高网站并发量,提升用户体验度. 注意:Nginx反向代理的缓存功能是由ngx_http_proxy_module提供, ...

  5. Nginx Rewrite相关功能

    目录 Nginx Rewrite相关功能 ngx_http_rewrite_module模块指令: if指令: set指令: break指令: return指令: rewrite_log指令: rew ...

  6. nginx前端负载,后端apache获取真实IP设置

    原文链接: nginx前端负载,后端apache获取真实IP设置 参考文献: 前端Nginx,后端Apache获取用户真实IP地址  按照第二种方法设置不成功! 网站最前端是nginx,做的PROXY ...

  7. Nginx 状态信息功能配置

    Nginx 状态信息功能介绍 Nginx 有一个 ngx_http_stub_status_module 模块,主要功能是记录 Nginx 的基本访问状态信息,让使用者了解 Nginx 的工作状态 要 ...

  8. 启动Nginx目录浏览功能及 让用户通过用户名密码认证访问web站点

    一.启动Nginx目录浏览功能  [root@abcdocker extra]# cat w.conf server { listen 80; server_name IP地址; location / ...

  9. 镜像回源主要用于无缝迁移数据到OSS,即服务已经在自己建立的源站或者在其他云产品上运行,需要迁移到OSS上,但是又不能停止服务,此时可利用镜像回写功能实现。

    管理回源设置_管理文件_开发指南_对象存储 OSS-阿里云 https://help.aliyun.com/document_detail/31865.html 通过回源设置,对于获取数据的请求以多种 ...

随机推荐

  1. dp(传球)

    https://ac.nowcoder.com/acm/contest/1126/B 链接:https://ac.nowcoder.com/acm/contest/1126/B来源:牛客网 上体育课的 ...

  2. Python 数据分析中金融数据的来源库和简单操作

    目录 金融数据 pandas-datareader TuShare 金融学图表 案例 金融数据 数据分析离不开数据的获取,这里介绍几种常用的获取金融方面数据的方法. pandas-datareader ...

  3. VS中发布并调试IIS程序

    1.创建本地IIS站点 2.修改配置 .net framework 右击项目属性,服务器修改为本地IIS,并且项目URL修改为相对应的站点即可 .net core 右键属性,进入调试栏新建一个配置 选 ...

  4. 第一个progressive web application,发车!

    progressive web application是谷歌推出的一种渐进式web应用,通过利用service-worker等来达到类似于原生应用,而且在chrome浏览器还可以添加到主页,完全就和一 ...

  5. 关于JSON使用要注意的地方

    1.json     1.JSON对象;(ES5)         1)JSON.stringify() json---js[json字符串--->JavaScript对象]         2 ...

  6. MySQL第五天——日志

    日志 log_error(错误日志) 用于记录 MySQL 运行过程中的错误信息,如,无法加载 MySQL数据库的数据文件,或权限不正确等都会被记录在此. 默认情况下,错误日志是开启的,且无法禁止. ...

  7. 2018-2-13-Windows-10-16251-添加的-api

    title author date CreateTime categories Windows 10 16251 添加的 api lindexi 2018-2-13 17:23:3 +0800 201 ...

  8. Debug to add expression

    Debug expression

  9. cf2c(模拟退火 步长控制

    https://www.luogu.org/problem/CF2C 题意:在平面上有三个没有公共部分的圆,求平面上一点使得到三个圆的切线的夹角相等.(若没答案满足条件,则不打印 思路:可用模拟退火算 ...

  10. whetstone

    https://www.cnblogs.com/findumars/p/4173040.html 下载源码:http://www.netlib.org/benchmark/whetstone.c ar ...