环境:centos7.2+lnmp1.3(nginx+php7.0+mysql5.5)

进入服务器配置路径:cd /usr/local/nginx/conf/nginx.conf 
修改nginx.conf文件vim nginx.conf,原来的文件内容不变,在最后加上我们需要的对thinkphpurl模式的解析 
修改后的nginx.conf文件如下:

user  www www;

worker_processes auto;

error_log  /home/wwwlogs/nginx_error.log  crit;

pid        /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile ; events
{
use epoll;
worker_connections ;
multi_accept on;
} http
{
include mime.types;
default_type application/octet-stream; server_names_hash_bucket_size ;
client_header_buffer_size 32k;
large_client_header_buffers 32k;
client_max_body_size 50m; sendfile on;
tcp_nopush on; keepalive_timeout ; tcp_nodelay on; fastcgi_connect_timeout ;
fastcgi_send_timeout ;
fastcgi_read_timeout ;
fastcgi_buffer_size 64k;
fastcgi_buffers 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k; gzip on;
gzip_min_length 1k;
gzip_buffers 16k;
gzip_http_version 1.1;
gzip_comp_level ;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\."; #limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. server_tokens off;
access_log off; server
{
listen default_server;
#listen [::]: default_server ipv6only=on;
server_name www.lnmp.org;
index index.html index.htm index.php;
root /home/wwwroot/default; #error_page /.html;
include enable-php.conf; location /nginx_status
{
stub_status on;
access_log off;
} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
} location ~ .*\.(js|css)?$
{
expires 12h;
} location ~ /\.
{
deny all;
} #应用部署在子目录sixchat下,如果部署在根目录下,需要去掉/sixchat
#ThnkPHP URL_MODEL=> rewrite 省略index.php
location /sixchat/ {
if (!-e $request_filename) {
rewrite ^/sixchat/(.*)$ /sixchat/index.php?s=$ last;
break;
}
}
# access_log /home/wwwlogs/access.log;
}
include vhost/*.conf;
}

最后,重启nginx服务器即可 service nginx restart

thinkphp 3.2.3在nginx+php下的url重写配置经验的更多相关文章

  1. 客户端禁用cookie情况下的URL重写

    客户端禁用cookie情况下的URL重写: servlet: package com.stono.servlet.listenerorder; import java.io.IOException; ...

  2. (Nginx和PHP下)URL重写,TP实现URL重写

    UrlRewrite就是我们通常说的地址重写,用户得到的全部都是经过处理后的URL地址. 优点 一:提高安全性,可以有效的避免一些参数名.ID等完全暴露在用户面前,如果用户随便乱输的话,不符合规则的话 ...

  3. CI在nginx环境下去掉url中的index.php

    在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中 ...

  4. Apache 和 Nginx 下的 URL 重写

    URL 重写和重定向 URL 重写是将页面映射到本站另一页面, 而重定向则是将页面映射到另一主机(域名). 其中临时重定向(R=302)和永久重定向(R=301)都是亲搜索引擎的, 是 SEO 的重要 ...

  5. nginx windows下重新加载配置

    运行过程中,有个节点部分服务出现故障,像将其下线修复, 使用nginx -t; nginx -s reload 重新加载配置 得到错误"nginx: [error] OpenEvent(&q ...

  6. Nginx 一些常用的URL 重写方法

    url重写应该不陌生,不管是SEO URL 伪静态的需要,还是在非常流行的wordpress里,重写无处不在. 1. 在 Apache 的写法 RewriteCond  %{HTTP_HOST}  n ...

  7. Nginx配置ThinkPHP下的url重写(隐藏入口)

    搭建好项目后,在网址上输入域名,只能访问首页,其他页面全是404. 在域名后面和控制器前面加上index.php就可以访问. 在tp5官网手册查找后进行配置修改. 打开nginx.conf 后 ,在s ...

  8. IIS集成模式下,URL重写后获取不到Session值

    近期给公司网站添加了伪静态功能,但是今天发现了在伪静态的页面中,Session值是获取不到的. 原因是在伪静态请求的时候,Session请求被“过滤”掉了. 开始是把web.config文件中的mod ...

  9. IIS下 Yii Url重写

    下载URL重写组件 http://www.microsoft.com/zh-cn/download/details.aspx?id=7435 导入官方提供的.htaccess文件 Options +F ...

随机推荐

  1. js实现个链表吧

    存储多个元素,最常用的数据结构是数组.但是数组有个一缺点,从数组中添加或移除项的成本很高,因为需要移动元素.链表也可以存储有序的元素集合,但是和数组不同,链表中的元素在内存中不是连续放置的.每个元素存 ...

  2. 使用HTTPS与SSL来保证安全性

    原文链接:https://developer.android.com/training/articles/security-ssl.html SSL,安全套接层(TSL),是一个常见的用来加密客户端和 ...

  3. linux System V IPC Mechanisms

    Message Queues Semaphores Shared Memory

  4. linux page allocation and deallocation

      All of the physical pages in the system are described by the mem_map  data structure which is a li ...

  5. Response.ContentType都有哪些?

    Response.ContentType 名称 类型ai application/postscriptaif audio/x-aiffaifc audio/x-aiffaiff audio/x-aif ...

  6. Flask初级(一)创建及运行flash

    和前面的django差不多,选个类型,定义个目录. 选个模板解释器,定义一个模板文件夹名称. Create就创建成功了. 运行一下.会显示 Hello World! 最好给它换个运行环境,建个虚拟环境 ...

  7. Python正则表达式操作指南

    摘要 本文是通过Python的 re 模块来使用正则表达式的一个入门教程,和库参考手册的对应章节相比,更为浅显易懂.循序渐进. 本文可以从 http://www.amk.ca/python/howto ...

  8. 1.2 C++命名空间(namespace)

    参考:http://www.weixueyuan.net/view/6326.html 总结: C++语言引入命名空间(Namespace)这一概念主要是为了避免命名冲突,其关键字为 namespac ...

  9. 离线使用Visual Studio的Javascript Prettier插件

    用Prettier插件来格式化Javascript代码效果好的不得了,简直是强迫症的救命克星,可惜单位的电脑是不联网的,始终用不了,今天抽空研究了一下,找到办法了. 1.下载JavaScript Pr ...

  10. C#并行开发_Thread/ThreadPool, Task/TaskFactory, Parallel

    大家好,本次讨论的是C#中的并行开发,给力吧,随着并行的概念深入,哥也赶上这个潮流了,其实之前讨论C#的异步调用或者C#中BeginInvoke或者Invoke都已经涉及了部分本篇的内容. 参考书目: ...