R
R
Roman Andreevich2018-12-14 09:46:38
JavaScript
Roman Andreevich, 2018-12-14 09:46:38

How to set up nodejs (express) socket.io nginx and have it all on localhost???

Colleagues, good day. Who set up such a stack on the localhost??????
The browser gives an error: GET prototype.localhost/socket.io/socket.io.js net::ERR_ABORTED 404 (Not Found).
in template: config nginx:
<script src="/socket.io/socket.io.js"></script>

server {
  listen 80;
  listen (:):80;

  server_name prototype.localhost;
  root /home/marey/projects/prototype.map;

  error_page 500 502 503 504 /50x.html;

  location = /50x.html {
    root /home/marey/projects/default;
  }

  location / {
    proxy_pass http://prototype.localhost:5000;
        proxy_redirect off;

        proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
  }

  include config/general.conf;
}

general.conf:
location ~* \.(jpg|jpeg|gif|png|ico|css|js|zip|rar|pdf)$ {

  expires off;

}

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;

How to setup on localhost. I understand that the problem is in the nginx configuration. Well, I really don’t want to remove socket.io.
Tell me who knows how to solve the problem. Thank you in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Alekseev, 2018-12-14
@shure348

download the finished assembly
on the git in bulk
, you can directly with the front part
, search by keyword for example MEVN (mongo express vue node)

R
Rhesus Negative, 2018-12-14
@RhesusNegative

run node server.js in the console
and I don’t see the port in the error, so the server is not enabled

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question