centos 7 上nginx安装多个Laravel

1、单个Laravel 的 nginx 配置

cd /etc/nginx/
vim nginx.conf
 ...
server {
        listen       80;
        server_name  localhost;
        add_header      X-Frame-Options "SAMEORIGIN";
        add_header      X-XSS-Protection "1,mode=block";
        add_header      X-Content-Type-Options "nosniff";
        index index.html index.htm index.php;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm index.php;
            try_files $uri $uri/ /index.php?$query_string;
        }

        error_page  404              /index.php;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            root           html;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny  all;
        }

    }
       include /etc/nginx/conf.d/*.conf;  #加载其他的配置文件
...

2、为每一个Laravel创建单独的配置文件,在conf.d文件加下创建一个监听8088端口的服务

server{

    listen 8088;
    server_name Lar;

    location / {
            root   html/Lar/public;
            index  index.html index.htm index.php;
            try_files $uri $uri/ /index.php?$query_string;
        }

     location ~ \.php$ {
            root           html/Lar/public;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,850评论 19 139
  • Laravel 学习交流 QQ 群:375462817 本文档前言Laravel 文档写的很好,只是新手看起来会有...
    Leonzai阅读 12,697评论 2 12
  • 第一章 Nginx简介 Nginx是什么 没有听过Nginx?那么一定听过它的“同行”Apache吧!Ngi...
    JokerW阅读 32,914评论 24 1,002
  • feisky云计算、虚拟化与Linux技术笔记posts - 1014, comments - 298, trac...
    不排版阅读 9,371评论 0 5
  • 天地变换,何为不朽? 三月烟花在震耳欲聋的爆炸声中隐匿于黑夜,一瞬的光亮点明天空,随即是黑暗;疆场热血嵌入金沙般的...
    叁爷S阅读 2,750评论 0 0

友情链接更多精彩内容