本文作者:DurkBlue

Laravel Nginx配置步骤详解

Laravel Nginx配置步骤详解摘要: 这是一个Laravel框架运行nginx服务器的配置示例,Laravel框架版本5.2.server {     lis...

这是一个Laravel框架运行nginx服务器的配置示例,Laravel框架版本5.2.

  1. server { 

  2.     listen       80; 

  3.     server_name  localhost; 

  4.     root   /usr/share/nginx/html/tanteng.me/public

  5.     index index.php index.html index.htm; 

  6.  

  7.     #charset koi8-r; 

  8.     #access_log  /var/log/nginx/log/host.access.log  main; 

  9.  

  10.     location / { 

  11.         try_files $uri $uri/ /index.php?$query_string

  12.     } 

  13.  

  14.     #error_page  404              /404.html; 

  15.  

  16.     # redirect server error pages to the static page /50x.html 

  17.     # 

  18.     error_page   500 502 503 504  /50x.html; 

  19.     location = /50x.html { 

  20.         root   /usr/share/nginx/html/tanteng.me/public

  21.     } 

  22.  

  23.     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 

  24.     # 

  25.     #location ~ \.php$ { 

  26.     #   proxy_pass   http://127.0.0.1; 

  27.     #} 

  28.  

  29.     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 

  30.     # 

  31.     location ~ \.php$ { 

  32.         fastcgi_pass   127.0.0.1:9000; 

  33.         fastcgi_index  index.php; 

  34.         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name

  35.         include        fastcgi_params; 

  36.     } 

  37.  

  38.     # deny access to .htaccess files, if Apache's document root 

  39.     # concurs with nginx's one 

  40.     # 

  41.     location ~ /\.ht { 

  42.         deny  all; 

  43.     } 

运行在CentOS 7环境,Nginx版本1.8.


此篇文章由DurkBlue发布,转载请注明来处
文章投稿或转载声明

来源:DurkBlue版权归原作者所有,转载请保留出处。本站文章发布于 2022-11-02
温馨提示:文章内容系作者个人观点,不代表DurkBlue博客对其观点赞同或支持。

赞(0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

阅读
分享

发表评论取消回复

快捷回复:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog

评论列表 (暂无评论,976人围观)参与讨论

还没有评论,来说两句吧...