Valet: is it possible to share node.js program running on port 3000

Created on 17 Feb 2018  路  5Comments  路  Source: laravel/valet

I am very new to node, so there may be an easy way around this. Is it possible? This is just a proof of concept program to show some colleagues.

Most helpful comment

yes, you can create a file in : ~/.valet/Nginx

mydomain.conf

map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     off;
}

server {
    listen          80;             # the port nginx is listening on
    server_name     mydomain.test;    # setup your domain here

    gzip            on;
    gzip_types      text/plain application/xml text/css application/javascript;
    gzip_min_length 1000;

    location / {
        expires $expires;

        proxy_redirect                      off;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_read_timeout          1m;
        proxy_connect_timeout       1m;
        proxy_pass                          http://127.0.0.1:3000; # set the adress of the Node.js instance here
    }
}

and

valet restart

done.

All 5 comments

yes, you can create a file in : ~/.valet/Nginx

mydomain.conf

map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     off;
}

server {
    listen          80;             # the port nginx is listening on
    server_name     mydomain.test;    # setup your domain here

    gzip            on;
    gzip_types      text/plain application/xml text/css application/javascript;
    gzip_min_length 1000;

    location / {
        expires $expires;

        proxy_redirect                      off;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_read_timeout          1m;
        proxy_connect_timeout       1m;
        proxy_pass                          http://127.0.0.1:3000; # set the adress of the Node.js instance here
    }
}

and

valet restart

done.

@mattstauffer IMO this can be closed

yes, you can create a file in : ~/.valet/Nginx

mydomain.conf

map $sent_http_content_type $expires {
    "text/html"                 epoch;
    "text/html; charset=utf-8"  epoch;
    default                     off;
}

server {
    listen          80;             # the port nginx is listening on
    server_name     mydomain.test;    # setup your domain here

    gzip            on;
    gzip_types      text/plain application/xml text/css application/javascript;
    gzip_min_length 1000;

    location / {
        expires $expires;

        proxy_redirect                      off;
        proxy_set_header Host               $host;
        proxy_set_header X-Real-IP          $remote_addr;
        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto  $scheme;
        proxy_read_timeout          1m;
        proxy_connect_timeout       1m;
        proxy_pass                          http://127.0.0.1:3000; # set the adress of the Node.js instance here
    }
}

and

valet restart

done.

@DJafari, i want to try your solution but I havent on my mac folder ~/.valet/Nginx
I need create this folder manually?

@webwm a long time back the Valet config directory moved from ~/.valet/ to ~/.config/valet/. You will find your Nginx directory there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

idmahbub picture idmahbub  路  3Comments

dustinleblanc picture dustinleblanc  路  4Comments

hsleewis picture hsleewis  路  5Comments

eberkund picture eberkund  路  4Comments

ellisio picture ellisio  路  4Comments