加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Nginx中运行PHP框架Laravel的配置文件分享

发布时间:2020-12-14 19:57:49 所属栏目:大数据 来源:网络整理
导读:配置文件改成这样 server { listen 80; server_name sub.domain.com; set $root_path '/srv/www/default'; root $root_path; index index.php index.html index.htm; try_files $uri $uri/ @rewrite; location @rewrite { rewrite ^/(.*)$ /index.php_url=/$

配置文件改成这样

server {
    listen 80; 
 server_name sub.domain.com; 
 set $root_path '/srv/www/default'; 
 root $root_path; 
  
 index index.php index.html index.htm; 
  
 try_files $uri $uri/ @rewrite; 
  
 location @rewrite { 
  rewrite ^/(.*)$ /index.php?_url=/$1; 
 } 
  
 location ~ .php { 
  
  fastcgi_pass 127.0.0.1:9000; 
  fastcgi_index /index.php; 
  
  fastcgi_split_path_info    ^(.+.php)(/.+)$; 
  fastcgi_param PATH_INFO    $fastcgi_path_info; 
  fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
  include            fastcgi_params;
 } 
  
 location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { 
  root $root_path; 
 } 
  
 location ~ /.ht { 
  deny all; 
 } 
  }

在CentOS7.1+Nginx1.8.0+Laravel5.0测试通过

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读