nginx下配置laravel+rewrite重写
server {
listen ;
server_name ha.d51v.cn;
#access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/demo/wechat_center/public;
index index.html index.htm index.php;
#error_page /.html;
#error_page /.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
#################以下是Nginx自定义配置的#######################
location / {
try_files $uri $uri/ /index.php?$query_string;
} if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$ permanent;
} # 去除index action
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$ permanent;
} # 根据laravel规则进行url重写
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$ last;
break;
}
#error_page /50x.html;
location = /50x.html {
root html;
}
}
nginx下配置laravel+rewrite重写的更多相关文章
- nginx下配置Yii2 rewrite、pathinfo等
环境说明: 我试用的lnmp安装包安装的nginx,nginx版本是1.14.1 server { listen ; server_name www.baidu.com; #access_log /d ...
- Nginx 下配置Laravel 错误404
宝塔的访问路径改一下 在站点的配置文件下面server里面加上 location / { try_files $uri $uri/ /index.php?$query_string; } 然后重启Ng ...
- Nginx下WordPress的Rewrite
最近接触WP Super Cache,该插件要求固定链接必须是重写的,故用到Rewrite. 我的是这样配置的: /usr/local/nginx/conf/rewrite/wordpress.con ...
- codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法
codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法 进入nginx的配置文件 加上一句(本来就有这句,只需要修改一下就行了) locatio ...
- tpadmin的坑收集 nginx下配置tp5失败
如下: 1.ADMIN模块如要关联查询,model的函数名一定不要有“_”下划线,否则找不到 /common/model/**.php 如果把函数名file写成“**_file”,调用时,$vo.** ...
- 如何在Nginx下配置PHP程序环境
1.nginx与PHP的关系 首先来看nginx与php的关系, FastCGI的关系(而不是像apache那样安装成nginx的模块) FastCGI的意思是, 快速的通用网关接口:CGI Comm ...
- NGINX下配置404错误页面的方法分享
NGINX下配置自定义的404页面是可行的,而且很简单,只需如下几步,需要的朋友可以参考下 1. 创建自己的404.html页面 2.更改nginx.conf在http定义区域加入: fastcg ...
- Ubuntu Nginx下配置网站ssl实现https访问
最近在看 HTTP权威指南 看到介绍了HTTPS的ssl,自己就动手测试了下,将步骤记录下 HTTPS简介 什么是HTTPS?百科是这样解释的.HTTPS(全称:Hyper Text Trans ...
- nginx下配置多个web服务
参考 nginx配置详解 nginx反向代理与负载均衡详解 一.nginx简介: Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能 ...
随机推荐
- Sql Server常用函数及技巧
使用Sql Server好长时间了,今天特别想总结一下,算是回顾吧! 总结: 其实很多技巧,都是基于SQL Server自带的System Views,System Stored Procedures ...
- PAT甲级——1105 Spiral Matrix (螺旋矩阵)
此文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90484058 1105 Spiral Matrix (25 分) ...
- 搞定C系语言的的swap
http://www.cs.utsa.edu/~wagner/CS2213/swap/swap.html 原地址 Parameters, by value and by reference: Both ...
- 1081 Rational Sum(20 分)
Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum. ...
- Jenkins执行yarn install报错:error An unexpected error occurred:"... ... :Unexpected end of JSON input"
解决方式: # cd /usr/local/n/versions/node/11.6.0/lib/(node的安装目录下) # rm -rf node_modules # yarn cache cle ...
- Centos安装TensorFlow和Keras
安装命令如下: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py pip install tensor ...
- IDEA在debug模式项目启动一半卡主,无法启动,也不报错
罪魁祸首就是手误 点了一下代码中方法的左侧打了个方法断点 Java Method Breakpoints 有时候debug启动很慢也有可能是这个原因,记录一下
- JavaScript中三种字符串连接方式及其性能比较
参考地址: https://www.cnblogs.com/programs/p/5554742.html 工作中经常会碰到要把2个或多个字符串连接成一个字符串的问题,在JS中处理这类问题一般有三种方 ...
- Game Engine Architecture
- Python3+Selenium3+webdriver学习笔记9(发送富文本信息及上传文件处理)
#!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记9(发送富文本信息及上传文件处理)'''from seleni ...