thinkphp 3.2.3在nginx+php下的url重写配置经验
环境: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重写配置经验的更多相关文章
- 客户端禁用cookie情况下的URL重写
客户端禁用cookie情况下的URL重写: servlet: package com.stono.servlet.listenerorder; import java.io.IOException; ...
- (Nginx和PHP下)URL重写,TP实现URL重写
UrlRewrite就是我们通常说的地址重写,用户得到的全部都是经过处理后的URL地址. 优点 一:提高安全性,可以有效的避免一些参数名.ID等完全暴露在用户面前,如果用户随便乱输的话,不符合规则的话 ...
- CI在nginx环境下去掉url中的index.php
在nginx环境下CI框架默认URL规则访问不了,出现500错误,如: http://blog.php230.com/index.php/keywords 今天在服务器配置CI框架环境时,去除URL中 ...
- Apache 和 Nginx 下的 URL 重写
URL 重写和重定向 URL 重写是将页面映射到本站另一页面, 而重定向则是将页面映射到另一主机(域名). 其中临时重定向(R=302)和永久重定向(R=301)都是亲搜索引擎的, 是 SEO 的重要 ...
- nginx windows下重新加载配置
运行过程中,有个节点部分服务出现故障,像将其下线修复, 使用nginx -t; nginx -s reload 重新加载配置 得到错误"nginx: [error] OpenEvent(&q ...
- Nginx 一些常用的URL 重写方法
url重写应该不陌生,不管是SEO URL 伪静态的需要,还是在非常流行的wordpress里,重写无处不在. 1. 在 Apache 的写法 RewriteCond %{HTTP_HOST} n ...
- Nginx配置ThinkPHP下的url重写(隐藏入口)
搭建好项目后,在网址上输入域名,只能访问首页,其他页面全是404. 在域名后面和控制器前面加上index.php就可以访问. 在tp5官网手册查找后进行配置修改. 打开nginx.conf 后 ,在s ...
- IIS集成模式下,URL重写后获取不到Session值
近期给公司网站添加了伪静态功能,但是今天发现了在伪静态的页面中,Session值是获取不到的. 原因是在伪静态请求的时候,Session请求被“过滤”掉了. 开始是把web.config文件中的mod ...
- IIS下 Yii Url重写
下载URL重写组件 http://www.microsoft.com/zh-cn/download/details.aspx?id=7435 导入官方提供的.htaccess文件 Options +F ...
随机推荐
- js中JSON.stringify用于自定义的类
参考:http://stackoverflow.com/questions/7356694/how-to-json-stringify-a-user-defined-class-in-javascri ...
- en_o out1
1● o əʊ ɒ ə ɔː ʌ ʊ: 2● oor ʊə ɔː 3● oo u u: 4● or ɜː ə ɔː 5● oar ore ɔː 6● ow əʊ aʊ ...
- JAVASCRIPT开发HTML5游戏--斗地主(网络对战PART4)
继之前用游戏引擎(青瓷引擎)做了斗地主单机版游戏之后,这里分享下使用socket.io来实现网络对战,代码可已放到github上,在此谈谈自己整个的开发思路吧. 客户端代码 服务端代码 (点击图片进入 ...
- div始终在底部
<style type="text/css">body{margin:0;padding:0; } html,body{height:100%;}div{width:1 ...
- MinGW的gdb调试
MinGW(Minimalist GNU for Windows)提供了一套简单方便的Windows下的基于GCC程序开发环境.MinGW收集了一系列免费的Windows是用的头文件和库文件: ...
- DevExpress WPF入门指南:跟随 Items Source 向导完成数据绑定
Items Source Wizard Items Source Configuration Wizard允许在设计时执行数据绑定.跟随这个向导可以自动生成XAML数据绑定代码. 下面就来展示下如何使 ...
- Sysinternals Suite 2014.08.18
Windows Sysinternals Suite 是一套由微软官方免费提供的系统工具集,其中包含了大量超级实的优秀绿色小软件,譬如 Desktops (虚拟桌面).Process Explorer ...
- This App does not have access to your photos or videos in iOS 9
出现这个总是由于info.plist文件内的CFBundleDisplayName没有值或者为空.把名称填进去就可以用了.
- H - 【59】Lazier Salesgirl 模拟//lxm
Kochiya Sanae is a lazy girl who makes and sells bread. She is an expert at bread making and selling ...
- XDocument 使用
摘要: 正文: 1.引入XDocument的命名空间 using System.Xml.Linq; 2. List<CourseItem> to XML doc //List<Cou ...