homestead icon indicating copy to clipboard operation
homestead copied to clipboard

Add new site type for webman framework

Open svpernova09 opened this issue 3 years ago • 8 comments

/cc @mouyong

Resolves https://github.com/laravel/homestead/issues/1764

Example configuration:

sites:
    - map: vcdt.test
      to: /home/vagrant/vcdt/public
      type: webman
      webman_port: 9393

Results in the following virutalhost:

upstream webman {
    server 127.0.0.1:9393;
}

server {
    listen 80;
    listen 443 ssl http2;
    server_name .vcdt.test;
    root "/home/vagrant/vcdt/public";

    index index.html index.htm index.php;

    charset utf-8;



    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;


        if (!-f $request_filename){
          proxy_pass http://webman;
        }
    }



    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/vcdt.test-error.log error;

    sendfile off;

    location ~ /\.ht {
        deny all;
    }

    ssl_certificate     /etc/ssl/certs/vcdt.test.crt;
    ssl_certificate_key /etc/ssl/certs/vcdt.test.key;
}

svpernova09 avatar Feb 25 '22 17:02 svpernova09

maybe we can add new site type for hyperf, it also need use upstream_port:

you can see this link.

https://hyperf.wiki/2.2/#/zh-cn/tutorial/nginx

image

image

mouyong avatar Feb 26 '22 05:02 mouyong

maybe we can add new site type for hyperf, it also need use upstream_port:

you can see this link.

If it's the same syntax as the webman you can use that same type.

svpernova09 avatar Feb 27 '22 00:02 svpernova09

Possible upstream_port than webman_port is more suitable. Why not use it.

And we can also add the websocket_port to variable 12 like this: site['websocket_port'] ||= $12, # $12

mouyong avatar Feb 27 '22 01:02 mouyong

Possible upstream_port than webman_port is more suitable. Why not use it.

And we can also add the websocket_port to variable 12 like this: site['websocket_port'] ||= $12, # $12

If we're adding port configuration for a site type and we need to support multiple site types, we should do that in the site type. I don't want to add many inputs that only specific types need.

svpernova09 avatar Feb 27 '22 01:02 svpernova09

if site need websocket, it can be use $12, if site need use upstream to listen application, it can be use $11.

mouyong avatar Feb 27 '22 01:02 mouyong

And the webman_port can only be used for webman framework. From a semantic point of view.

mouyong avatar Feb 27 '22 01:02 mouyong

And webman_port is a PHP framework setting, and the upstream_port and the websocket_port are nginx settings.

mouyong avatar Feb 27 '22 01:02 mouyong

Apologies, I haven't forgotten about this.

svpernova09 avatar Mar 16 '22 23:03 svpernova09

Closing this as I completely neglected it. if you'd like to PR a webman site type I'll happily review it.

svpernova09 avatar Oct 02 '22 19:10 svpernova09