Virtual Machine Nginx Port Forwarding to Host
Nginx port Ubuntu 18.04 at the virtual machine
Go to Nginx sites-available directory and open default file
$ cd /etc/nginx/sites-available
$ sudo gedit default
Adding the default file with few ports listening
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# Nodejs Proxy
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 92;
location / {
proxy_pass http://localhost:19999/;
include /etc/nginx/proxy_params;
}
}
$ sudo service nginx restart
So we are finish .. then let see if it is working or not.
Check your vm http://localhost:91
Port Forwarding to Host
At our VM instance terminal, we need to make our port as public
Allow firewall to access the port by using
$ sudo ufw allow 91/tcp
Allow firewall to access the port by using
$ sudo ufw allow 91/tcp
Choose setting at your instance
Go to Network > Adapter 1 > Nat > Port Forwarding
Then to let see at our host at localhost:92
So it is working.
If we open directly netdata at our VM instance it will use more CPU resources. By open at host machine our instance use fewer CPU resources.
Disclaimer:
This setup for my research purpose as a note for myself, so my explanation might not be clear enough for a beginner. By the way, at this current time, people love to use Docker, Kubernetes, or AWS.
Langgan:
Catat Ulasan
(
Atom
)
Tiada ulasan :
Catat Ulasan