(base) marco@pc:~/vueMatters/testproject$ sudo ufw status
Status: inactive
This makes no sense.
Please show:
ifconfig | grep -E 'add|inet'
(base) marco@pc:~/vueMatters/testproject$ ifconfig | grep -E 'add|inet'
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
inet6 fe80::42:fff:fe05:b837 prefixlen 64 scopeid 0x20
inet 192.168.1.7 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::7a24:afff:fe43:ef5c prefixlen 64 scopeid 0x20
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
inet6 fe80::24e5:f4ff:fe2d:be93 prefixlen 64 scopeid 0x20
Please show the sudo netstat again
I executed ifconfig | grep -E āadd|inetā on the pc, which is the server
Executed on the PC-Server:
(base) marco@pc:~/vueMatters/testproject$ sudo netstat again
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.1.7:51606 192.168.1.7:2377 ESTABLISHED
tcp 0 164 192.168.1.7:ssh 192.168.1.4:53584 ESTABLISHED
tcp 0 0 192.168.1.7:ssh 192.168.1.4:40406 ESTABLISHED
tcp 0 0 192.168.1.7:ssh 162.220.162.38:4760 SYN_RECV
tcp 0 0 localhost:epmd localhost:52725 ESTABLISHED
tcp 0 0 localhost:52725 localhost:epmd ESTABLISHED
tcp6 0 0 pc:2377 pc:51606 ESTABLISHED
udp6 0 0 localhost:55002 localhost:55002 ESTABLISHED
udp6 0 0 localhost:43040 localhost:43040 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 DGRAM 30974 /run/user/1000/systemd/notify
unix 3 DGRAM 20525 /run/systemd/notify
unix 8 DGRAM 20538 /run/systemd/journal/dev-log
unix 2 DGRAM 20549 /run/systemd/journal/syslog
unix 10 DGRAM 20561 /run/systemd/journal/socket
unix 3 STREAM CONNECTED 24788
unix 3 DGRAM 30976
unix 3 STREAM CONNECTED 21268
unix 3 STREAM CONNECTED 26815 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 24789
unix 3 STREAM CONNECTED 28829 /run/containerd/containerd.sock
unix 3 STREAM CONNECTED 21271 /var/run/dbus/system_bus_socket
unix 3 STREAM CONNECTED 63362
unix 3 STREAM CONNECTED 21270 /var/run/dbus/system_bus_socket
unix 3 STREAM CONNECTED 29820 /run/containerd/containerd.sock
unix 2 DGRAM 21250
unix 3 STREAM CONNECTED 21275 /var/run/dbus/system_bus_socket
unix 2 DGRAM 82403
unix 2 DGRAM 504
unix 3 DGRAM 20526
unix 3 STREAM CONNECTED 24626 /run/systemd/journal/stdout
unix 3 DGRAM 30975
unix 2 DGRAM 20597
unix 3 STREAM CONNECTED 30725
unix 3 STREAM CONNECTED 19884 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 33853
unix 3 STREAM CONNECTED 21452
unix 3 DGRAM 22231
unix 3 DGRAM 22232
unix 3 STREAM CONNECTED 18392
unix 3 STREAM CONNECTED 25674 /run/systemd/journal/stdout
unix 3 DGRAM 21194
unix 3 STREAM CONNECTED 21453
unix 3 STREAM CONNECTED 22371
unix 3 DGRAM 21193
unix 3 STREAM CONNECTED 26819 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 24787
unix 3 STREAM CONNECTED 30724
unix 3 STREAM CONNECTED 21269
unix 2 DGRAM 30021
unix 3 STREAM CONNECTED 32933 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 21240
unix 3 STREAM CONNECTED 24785
unix 3 STREAM CONNECTED 24053
unix 3 STREAM CONNECTED 24625 /run/systemd/journal/stdout
unix 2 DGRAM 30963
unix 3 STREAM CONNECTED 24786
unix 3 STREAM CONNECTED 22289
unix 3 DGRAM 21196
unix 3 STREAM CONNECTED 1379
unix 3 STREAM CONNECTED 24758 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 24790
unix 3 STREAM CONNECTED 24914
unix 2 DGRAM 25675
unix 3 STREAM CONNECTED 63363
unix 3 DGRAM 20527
unix 3 STREAM CONNECTED 24791
unix 2 DGRAM 21477
unix 3 STREAM CONNECTED 806
unix 3 STREAM CONNECTED 31847
unix 3 STREAM CONNECTED 24373
unix 3 STREAM CONNECTED 25681
unix 2 DGRAM 67919
unix 3 STREAM CONNECTED 19158
unix 3 STREAM CONNECTED 24792
unix 3 DGRAM 21195
unix 2 DGRAM 21267
unix 3 STREAM CONNECTED 1850 /run/systemd/journal/stdout
unix 2 DGRAM 21272
unix 3 STREAM CONNECTED 30875 /var/run/docker/swarm/control.sock
unix 3 STREAM CONNECTED 24658 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 22457
unix 3 STREAM CONNECTED 22459 /var/run/dbus/system_bus_socket
unix 3 STREAM CONNECTED 18414 /var/run/dbus/system_bus_socket
unix 3 STREAM CONNECTED 28814
unix 3 STREAM CONNECTED 21278
unix 3 STREAM CONNECTED 26133
unix 3 STREAM CONNECTED 31340
unix 3 STREAM CONNECTED 21500 /run/systemd/journal/stdout
unix 2 DGRAM 18296
unix 3 STREAM CONNECTED 24603 /run/systemd/journal/stdout
unix 2 DGRAM 20944
unix 3 DGRAM 21177
unix 3 STREAM CONNECTED 24799
unix 3 STREAM CONNECTED 24797
unix 3 STREAM CONNECTED 19299 /run/systemd/journal/stdout
unix 2 DGRAM 33860
unix 3 STREAM CONNECTED 24290
unix 3 STREAM CONNECTED 24798
unix 3 DGRAM 21180
unix 3 STREAM CONNECTED 19300 /run/systemd/journal/stdout
unix 3 DGRAM 20949
unix 3 STREAM CONNECTED 24800
unix 3 STREAM CONNECTED 27793 /var/run/dbus/system_bus_socket
unix 3 STREAM CONNECTED 31341
unix 3 STREAM CONNECTED 26347
unix 3 STREAM CONNECTED 24794
unix 3 STREAM CONNECTED 21326
unix 2 DGRAM 21170
unix 3 DGRAM 21178
unix 3 STREAM CONNECTED 19380 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 24796
unix 3 DGRAM 21179
unix 3 STREAM CONNECTED 18109
unix 3 STREAM CONNECTED 493
unix 3 STREAM CONNECTED 27792
unix 3 STREAM CONNECTED 19879 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 24793
unix 3 DGRAM 20948
unix 3 STREAM CONNECTED 24472 /run/systemd/journal/stdout
unix 3 STREAM CONNECTED 1017
unix 3 STREAM CONNECTED 24795
no.
sudo netstat -pant | grep -i listen
Executed on the PC-Server:
(base) marco@pc:~/vueMatters/testproject$ sudo netstat -pant | grep -i listen
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 995/postgres
tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN 996/postgres
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 923/nginx: master p
tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN 1123/beam.smp
tcp 0 0 127.0.0.1:5986 0.0.0.0:* LISTEN 1123/beam.smp
tcp 0 0 0.0.0.0:37677 0.0.0.0:* LISTEN 1123/beam.smp
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 806/rpcbind
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 22783/node
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 923/nginx: master p
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1151/epmd
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 923/nginx: master p
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 867/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1187/sshd
tcp6 0 0 ::1:5432 :::* LISTEN 995/postgres
tcp6 0 0 ::1:5433 :::* LISTEN 996/postgres
tcp6 0 0 :::2377 :::* LISTEN 1138/dockerd
tcp6 0 0 :::7946 :::* LISTEN 1138/dockerd
tcp6 0 0 :::111 :::* LISTEN 806/rpcbind
tcp6 0 0 :::80 :::* LISTEN 923/nginx: master p
tcp6 0 0 :::4369 :::* LISTEN 1151/epmd
tcp6 0 0 :::22 :::* LISTEN 1187/sshd
Ok there is a subtle difference that I first overllooked.
It does NOT say 0.0.0.0:8080
it says 127.0.0.1:8080
So we can't connect via 192.168.1.7:8080
only by 127.0.0.1:8080
[or localhost:8080 - because localhost = 127.0.0.1]
So...
let's try (on the server):
curl -Iki http://localhost:8080/
curl -Iki http://127.0.0.1:8080/
Executed on the PC-Server:
(base) marco@pc:~/vueMatters/testproject$ curl -Iki http://localhost:8080/
HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 774
ETag: W/"306-TZR5skx9okrXHMJbxwuiUem3Jkk"
Date: Wed, 29 Jan 2020 15:46:18 GMT
Connection: keep-alive
Perfect!
Now you need to be sure the nginx proxy statement uses "http://localhost:8080/"
or "http://127.0.0.1:8080"
(base) marco@pc:~/vueMatters/testproject$ sudo nano /etc/nginx/conf.d/default.conf :
server {
listen 443 ssl http2 default_server;
server_name ggc.world;
ssl_certificate /etc/ssl/certs/chained.pem;
ssl_certificate_key /etc/ssl/private/domain.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:50m;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
#ssl_stapling on;
#ssl_stapling_verify on;
access_log /var/log/nginx/ggcworld-access.log combined;
add_header Strict-Transport-Security "max-age=31536000";
location = /favicon.ico { access_log off; log_not_found off; }
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
error_page 497 https://$host:$server_port$request_uri;
server_name www.ggc.world;
return 301 https://$server_name$request_uri;
access_log /var/log/nginx/ggcworld-access.log combined;
add_header Strict-Transport-Security "max-age=31536000";
location = /favicon.ico { access_log off; log_not_found off; }
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
# https://www.nginx.com/blog/nginx-nodejs-websockets-socketio/
# https://gist.github.com/uorat/10b15a32f3ffa3f240662b9b0fefe706
# http://nginx.org/en/docs/stream/ngx_stream_core_module.html
upstream websocket {
ip_hash;
server localhost:3000;
}
server {
listen 81;
server_name ggc.world www.ggc.world;
location / {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
#location /socket.io/socket.io.js {
# proxy_pass http://websocket;
#}
}
Ok that should be good.
Now (on the server) try:
curl -Iki https://localhost/
then from your laptop:
https://192.168.1.7/
On the PC-Server:
(base) marco@pc:~/vueMatters/testproject$ curl -Iki https://localhost/
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Wed, 29 Jan 2020 15:51:59 GMT
content-type: text/html; charset=UTF-8
content-length: 774
x-powered-by: Express
accept-ranges: bytes
etag: W/"306-TZR5skx9okrXHMJbxwuiUem3Jkk"
strict-transport-security: max-age=31536000
and from the laptop:
A bit better.
But it seems that the js app is passing links to localhost which will fail on the client PC.
There may be a way to hide those links behind the nginx.
let me check on thatā¦
Iām sorry I canāt find anything āsimpleā.
Try reading through the vue.js app docs on how that can/should be done.
Iām trying to understandā¦ which kind of links the vue.js app seems passing to localhost?
Iām going by the red lines in your last picture - I mad be wrong, I donāt have access to your system.
Yesterday I wrote here where I found that other people had the same problem: https://github.com/webpack/webpack-dev-server/issues/416
Following the suggestions found there I modified the webpack.config.js in this way:
{
"mode": "development",
"entry": [
"src/index.js",
"webpack-dev-server/client?http://" + require("os").hostname() + ":3000/"
],
"output": {
"path": __dirname+'/static',
"filename": "[name].[chunkhash:8].js"
},
"module": {
"rules": [
{
"test": /\.vue$/,
"exclude": /node_modules/,
"use": "vue-loader"
},
{
"test": /\.pem$/,
"use": "file-loader"
}
]
},
plugins: [
new BrowserSyncPlugin(
{
host: 'localhost',
port: 3000,
proxy: 'http://localhost:8080'
},
{
reload: false
}
),
],
node: {
__dirname: false,
__filename: false
},
resolve: {
extension: ['*', '.pem']
}
}
And this is the vue.config.js :
module.exports = {
// options...
publicPath: '',
devServer: {
host: 'localhost'
}
}
But still, the problem persists
@rg305 What does it mean āX-Powered-By: Expressā in the output of curl?
(base) marco@pc:~/vueMatters/testproject$ curl -Iki http://localhost:8080/
HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Content-Length: 774
ETag: W/ā306-TZR5skx9okrXHMJbxwuiUem3Jkkā
Date: Wed, 29 Jan 2020 16:33:19 GMT
Connection: keep-alive