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

高洛峰
发布: 2023-03-04 19:12:01
原创
1487 人浏览过

配置文件改成这样

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测试通过

更多Nginx中运行PHP框架Laravel的配置文件相关文章请关注PHP中文网!


相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!