zoukankan      html  css  js  c++  java
  • laravel的nginx配置

    laravel的nginx的配置:

     1 server {
     2         listen       80;
     3         server_name  localhost alias 127.0.0.1;
     4         location / {
     5             root   E:/down/UPUPW_NGINX_PHP5.6.7_1504_32bit/upupw/htdocs/laravel/public;
     6             index  index.html index.htm default.html default.htm index.php default.php app.php u.php;
     7             try_files      $uri $uri/ /index.php?$query_string;
     8             include        E:/down/UPUPW_NGINX_PHP5.6.7_1504_32bit/upupw/htdocs/up-*.conf;
     9         }
    10         autoindex off;
    11         include advanced_settings.conf;
    12         location ~ ^.+.php {
    13             root           E:/down/UPUPW_NGINX_PHP5.6.7_1504_32bit/upupw/htdocs/laravel/public;
    14             fastcgi_pass   bakend;
    15             fastcgi_index  index.php;
    16             fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
    17             fastcgi_param  PATH_INFO $fastcgi_path_info;
    18             fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
    19             include        fastcgi.conf;
    20         }
    21         location ~* ^.+.*/(attachment|attachments|uploadfiles|avatar)/.*.(php|php5|phps|asp|aspx|jsp)$ {
    22         deny all;
    23         }
    24         }
    25 #server localhost end}

    //注意两处,

    (1):laravel的根目录是在public目录下面,所以需要修改”location “ 模块的 根目录地址 root项为laravel的安装路径;

    (2):其他的动态文件,即所有以.php结尾的文件,都交给上面设置的根目录处理,修改" location ~ ^.+.php "模块的root项的根目录为laravel的安装路径.

    配置文件的servername 即监听的域名此处配置为:localhost,当然也可以改成其他的域名作为访问lavarel目录的域名,在浏览器处输入localhost 或 127.0.0.1 即可以访问laravel.截图如下:

  • 相关阅读:
    Maven pom.xml中添加指定的中央仓库
    命令行远程链接MySQL
    A required class was missing while executing org.apache.maven.plugins:maven-war-plugin:2.1.1:war
    mvn deploy命令上传包
    保存好你的密码
    PuTTY免输密码自动登录Linux
    ActiveMQ无法启动
    linux控制台批量杀进程
    dubbo入门之微服务客户端服务端配置
    dubbo入门之helloWorld
  • 原文地址:https://www.cnblogs.com/xiaoyuqin/p/4778069.html
Copyright © 2011-2022 走看看