在homestead上面运行tp5

1.在 Homestead/scripts 目录下新建文件 serve-tp5.sh

#!/usr/bin/env bash
declare -A params=$6     # Create an associative array
paramsTXT=""
if [ -n "$6" ]; then
   for element in "${!params[@]}"
   do
      paramsTXT="${paramsTXT}
      fastcgi_param ${element} ${params[$element]};"
   done
fi

block="server {
    listen ${3:-80};
    listen ${4:-443} ssl http2;
    server_name .$1;
    root \"$2\";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        #try_files \$uri \$uri/ /index.php?\$query_string;
        if (!-e \$request_filename) {
           rewrite  ^(.*)$  /index.php?s=/\$1  last;
           #break;
        }
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/$1-error.log error;

    sendfile off;

    client_max_body_size 100m;


    location ~* ^(/images|/Static).+.(jpg|jpeg|css|gif|png|ico) {
        access_log              off;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  \$document_root\$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    ssl_certificate     /etc/nginx/ssl/$1.crt;
    ssl_certificate_key /etc/nginx/ssl/$1.key;
}
"

echo "$block" > "/etc/nginx/sites-available/$1"
ln -fs "/etc/nginx/sites-available/$1" "/etc/nginx/sites-enabled/$1"

2.Homestead.yaml 文件添加 type 设置

- map: tlst.com 
      to: /home/vagrant/Code/TLST/tlst/www.petun
      type: tp5

3.重启配置

vagrant reload --provision

备注:会在homestead中生成以下配置

server {
    listen 80;
    listen 443 ssl http2;
    server_name .tlst.com;
    root "/home/vagrant/Code/TLST/tlst/www.petun";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        #try_files $uri $uri/ /index.php?$query_string;
        if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=/$1  last;
           #break;
        }
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/tlst.com-error.log error;

    sendfile off;

    client_max_body_size 100m;


    location ~* ^(/images|/Static).+.(jpg|jpeg|css|gif|png|ico) {
        access_log              off;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

    ssl_certificate     /etc/nginx/ssl/tlst.com.crt;
    ssl_certificate_key /etc/nginx/ssl/tlst.com.key;
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在湘雅附二做完复查已经有好几天了,但我脑子里却时常会想起那天在骨扫描候诊室与病友们闲聊时的情形。到现在,我依然清晰...
    贺碧琼阅读 9,090评论 85 121
  • 在夏天很多头发长的女生都有想剪头发的冲动,于是就心动不如行动,带着冲动冲进了理发店,理发师咔嚓两刀就剪了,长长的头...
    任性的girl阅读 3,427评论 0 0
  • 所谓的职业化,就是商业世界的教养。 很喜欢这样的定义,有没有教养,我们是很容易去判断的。 下雨天,你站在路旁,前方...
    七夜98阅读 4,106评论 0 0
  • 基本类型和引用类型的值 基本类型值指的是简单的数据段。 引用类型值指那些由多个值构成的对象。 在将一个值赋给变量时...
    落花的季节阅读 1,105评论 0 1