server {
listen 80;
server_name _;
root /opt/sites;
index index.php index.html index.htm;
etag on; gzip on;
gzip_vary on;
gzip_http_version 1.0;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_disable msie6;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/xml+rss; client_max_body_size 110m;
client_body_buffer_size 1024k; keepalive_timeout 60; sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
tcp_nodelay on; # 此处配置二级目录站点
location /son{
alias /opt/sites/cms/public;
index index.html index.php; try_files $uri $uri/ /index.php?$query_string; location ~ \.php$ {
if (!-f $request_filename) {
return 404;
} fastcgi_pass unix:/tmp/php-fpm-72.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
} #此处是根目录下配置laravel站点
location / {
try_files $uri $uri/ /index.php?$query_string;
} location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm-72.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
}

这次遇到的问题是在访问http://localhost/son访问不了index.php,而index.html可以访问。在参考了https://laravel-china.org/articles/14235/nginx-configuring-two-level-virtual-directory-access-laravel-rewrite解决.

Nginx 配置二级虚拟目录访问 Laravel 重写的更多相关文章

  1. 安装Alertmanager,nginx配置二级路径代理访问

    安装配置 Alertmanager wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertman ...

  2. LAMP虚拟主机配置以及控制目录访问

    3.基于域名的虚拟主机配置 NameVirtualHost192.168.3.32:80#apache2.2.xx版本需要开启此选项,而且要和下面的保持一致:2.4.x版本就不需要此项设置了 < ...

  3. php 配置主机虚拟目录(使用虚拟域名访问 127.0.0.1) 一点也不好使?????

    php 配置主机虚拟目录(使用虚拟域名访问 127.0.0.1)steps:1>打开目录  D:\xwamp\bin\apache\apache2.4.9\conf     修改文件 httpd ...

  4. 使用nginx配置二级域名

    使用nginx配置二级域名 2018.11.21 11:51:17字数 613阅读 170 最近想把三个项目配在一个服务器上,于是想使用nginx配置二级域名实现. 1.域名添加解析 我的是阿里云的域 ...

  5. Windows下Nginx配置SSL实现Https访问(包含证书生成)

    Vincent.李   Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...

  6. 关于使用ssm与spring时,配置tomcat 虚拟目录( doBase )中的一些坑

    一.使用SSM需要 配置虚拟目录时 tomcat的配置 在tomcat server.xml的<HOST></HOST>中加入以下内容 在配置完成之后,当我们访问URL  为  ...

  7. Nginx反向代理的目录访问问题

    Nginx反向代理的目录访问问题 2013-05-13 23:21 2730人阅读 评论(0) 收藏 举报 从昨天就开始纠结了,在做实验的时候,遇到目录访问的问题,如下 前端nginx vhost的设 ...

  8. JSP配置了虚拟目录使用JavaBean报错

    今天遇到一个很棘手的问题,在jsp文件中使用useBean,网页返回码出现了500服务器内部错误,报错信息如下: The value for the useBean class attribute w ...

  9. 解决nginx发布网站跨目录访问

    解决nginx发布网站跨目录访问(thinkphp5+lnmp) 到:usr/local/nginx/conf/vim fastcgi.cof 把最后一行加上井号#注释掉保存重启 restart 参考 ...

随机推荐

  1. Idea+Spring boot 开启热部署

    热部署是spring boot的一大亮点功能,开发者不必因为改动一点代码就去频繁的关开服务. 1) 在pom文件中加载热部署依赖和插件 2)CTRL + SHIFT + A --> 查找make ...

  2. mysql存储ip数值

    字段使用 int unsigned 类型就可以满足存贮ip2long(ip)的数值 插入时,可以使用inet_aton('100.200.30.22') 将ip地址转换为数值 查询时,使用inet_n ...

  3. create-react-app 构建的项目使用 mobx (说到底就是为了使用装饰器语法对 babel 做些配置

    在 create-react-app 命令行构建的 React 项目中使用 Mobx 会出现如下警告: Support for the experimental syntax 'decorators- ...

  4. [LeetCode]-DataBase-Employees Earning More Than Their Managers

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

  5. js的浅拷贝和深拷贝和应用场景

    为什么会用到浅拷贝和深拷贝 首先来看一下如下代码 let a = b = 2 a = 3 console.log(a) console.log(b) let c = d = [1,2,3] let e ...

  6. 20182335实验一《Linux基础与Java开发环境》

    课程:<程序设计与数据结构> 班级: 1823 姓名: 李金泉 学号:20182335 实验教师:王志强 实验日期:2019年9月9日 必修/选修: 必修 1.实验内容 基于命令行和IDE ...

  7. maven之pom.xml的配置

    pom.xml是配置文件: <dependencies>表示依赖,里面可以有多个<dependency> 比如当前使用了junit的jar包,版本是3,8,1,我们现在更换新的 ...

  8. A 内存挂 B 封包挂 C 钩子挂 D CALL挂 外挂

    https://www.zhihu.com/question/32291769 作者:猎狐链接:https://www.zhihu.com/question/32291769/answer/70929 ...

  9. RequestMapping 注解的解析、匹配、注册

    RequestMapping 注解的解析.匹配.注册 1)创建 RequestMappingHandlerMapping 实例时会触发 afterPropertiesSet 调用. 2)读取容器中所有 ...

  10. JavaScript-W3School-Browser 对象:Window open() 方法

    ylbtech-JavaScript-Runoob-Browser 对象:Window open() 方法 1.返回顶部 1. Window open() 方法  Window 对象 定义和用法 op ...