Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try to add pm2 to run nuxtjs app on nginx #1459

Closed
Qanah opened this issue Mar 31, 2018 · 9 comments
Closed

try to add pm2 to run nuxtjs app on nginx #1459

Qanah opened this issue Mar 31, 2018 · 9 comments
Labels

Comments

@Qanah
Copy link

Qanah commented Mar 31, 2018

Info:

  • Docker version ($ docker --version): 18.03.0-ce, build 0520e24
  • Laradock commit ($ git rev-parse HEAD): fb686fec15c6b51cd06a96e42542b72ebb277d6c
  • System info (Mac, PC, Linux): Mac
  • System info disto/version:

Issue:

my app is laravel api and nuxt js to fronted
My folder structure look like this:

+ laravel
    + laradock
    + client

first i add to docker-compose.yml

pm2:
      build:
        context: ./pm2
      ports:
        - "${PM2_PORT}:3000"
      volumes_from:
        - applications
      networks:
        - frontend
        - backend

from http://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/

FROM keymetrics/pm2:latest-alpine

WORKDIR /var/www/client

COPY pm2.json .

CMD [ "pm2-runtime", "start", "pm2.json" ]

EXPOSE 3000

on nginx i add this config
https://nuxtjs.org/faq/nginx-proxy

server {

    listen 80;
    listen [::]:80;

    server_name client.com www.client.com;

    location / {
        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;
    }

    error_log /var/log/nginx/client_error.log;
    access_log /var/log/nginx/client_access.log;
}

i spin 3 days on this issue i dont have any experience on docker please any one can help me
i just get 502 Bad Gateway form nginx put the api is working will by grate laradock

@mazen1985
Copy link

I have the same issue, any luck?!

@spmsupun
Copy link

Here how i did this:
.env add this line
WORKSPACE_INSTALL_NPM_PM2=true
docker-compose.yml add env variable to workspace
- INSTALL_NPM_PM2=${WORKSPACE_INSTALL_NPM_PM2}

and finally add this to workspace Dockerfile near the RUN if [ ${INSTALL_NODE} = true ]; then \
&& if [ ${INSTALL_NPM_PM2} = true ]; then
npm install -g pm2
;fi \

this is my fork: https://github.com/lifeeka/laradock

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 23, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 23, 2020
@garbinmarcelo
Copy link
Contributor

I have the same problem here. How to use Nuxt (http://localhost:3000) with laradock?

@diego-lipinski-de-castro

Update on this?

@hedeqiang
Copy link

I have the same problem here. How to use Nuxt (http://localhost:3000) with laradock?

@victoralbino
Copy link

Update on this?

@shubhamchugh
Copy link

any update

how to work with laradock & pm2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants