BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk Server with Apache Server

hardware
#1

I have VPS (ubuntu server) and running a few domains (www.example1. com, www.example2. com) using Apache web server on it.

My question is, is it possible to run website along with the blynk server? So that I can install blynk server on my VPS without the need of another VPS server.

0 Likes

#2

Blynk Server is small, so as long as the resources and Java are there it can run just fine alongside other stuff.

I am running my Blynk Server, a couple of Blynk Clients, a File Server and the Raspbian OS on a RPi with no problems.

EDIT, perhaps I am misunderstanding the question?

0 Likes

#3

really no need since it uses separate ports.

however, lets say you want to reverse proxy, i’ve never had luck using certs on reverse proxy. I’ve just never tried hard enough.

is your vps hosted where you will only get ports 80/443 ?

0 Likes

#4

I don’t think so.

I guess VPS providers don’t limit only to few ports.

Currently I’m trying to setup on DigitalOcean server ( https://www.digitalocean.com/ ).

And one more question is,

If I execute the below commands on my server to install blynk server

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 9443

my websites stop working. (I guess by default web server works on port 80 and 443)

Is it required to execute those commands on server to run blynk server? or without executing those command we can still access blynk server?

0 Likes

#5

Blynk instructions want you to do that so you avoid any certbot registration issues. its not needed if you already have certs. Instead you probably need to do it for 8080 and 9443 though.

here ‘should’ be the rules you’ll need.

iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -p tcp --dport 9443 -j ACCEPT
0 Likes

#6

My server has enough resource. I don’t have an issue with the resource (RAM or Space).

What my doubt is when I execute the port forwarding command which is as shown below

Port forwarding for HTTP/S API

 sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
    sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 9443

websites won’t open.

Is it mandatory to execute that command on VPS?

0 Likes

#7

That I can’t say… I have ran mine on a Linux Box (Mint) and RPi (current method) and even in Windows 10… and have NEVER had to run that command. I handle all port forwarding via my router… so probaly nothing like how a VPS works.

0 Likes

#8

virtual private server:
think of it like a vmWare server… One big massive server (called a hypervisor / ESX host) that has a bunch of little servers under it. Not all of them use the ram at the same time or the diskspace (or the bandwidth)

In the end, its just a machine that runs under another.
I know im off topic here gunner, but you have always seemed eager to experiment. you have to give this one a go once, just to see what it does.
There are a ton to pick from. it appears the most recent, popular one, is https://www.virtualbox.org/

@pkarun, sorry for sidetracking our post here, gunner got me over the hump when i started with bynk, so i hope to someday return the favor.
How you doing on your iptables?

0 Likes

#9

The problem is, I still not able to run blynk on my VPS server yet that is the reason I couldn’t check myself by disabling iptable port redirect stuff to check whether it works or not.

I’m actually getting success message on my VPS server when I run server start command

root@ubuntu-s-1vcpu-1gb-blr1-01:~# java -jar server-0.41.2-java8.jar -dataFolder /home/pi/Blynk

but for some reason, I’m still not able to open the blynk admin page on my browser.

Here is my test VPS server IP address that I’m trying now: http://139.59.21.5:9443/admin (I will delete this server in few days/hours).

When I directly enter Server Public IP (http://139.59.21.5 ) it is redirecting to blynk home page (https://www.blynk.cc/).

Below is the log file entry:

03:12:53.784 INFO - Using data dir '/home/pi/Blynk'
03:12:54.732 INFO - Region : local. Host : 10.47.0.5.
03:12:54.792 INFO - Using native epoll transport.
03:12:55.495 INFO - Initializing gmail smtp mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
03:12:55.564 INFO - Reports : 0
03:12:55.571 INFO - Didn't find custom user certificates.
03:12:55.574 INFO - Didn't find Let's Encrypt certificates.
03:12:55.581 WARN - You didn't specified 'server.host' or 'contact.email' properties in server.properties file. Automatic certificate generation is turned off. Please specify above properties for automatic certificates retrieval.
03:12:55.582 INFO - Using native openSSL provider.
03:12:55.582 WARN - ATTENTION. Server certificate paths (cert : '/root', key : '/root') not valid. Using embedded server certs and one way ssl. This is not secure. Please replace it with your own certs.
03:12:56.382 INFO - HTTP API and WebSockets server listening at 8080 port.
03:12:56.384 INFO - HTTPS API, WebSockets and Admin page server listening at 9443 port.
03:12:56.385 INFO - Mqtt hardware server listening at 8440 port. 

Below are the commands that I followed to install blynk on my server:


sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer



java -version


wget "https://github.com/blynkkk/blynk-server/releases/download/v0.41.2/server-0.41.2-java8.jar"


sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 9443

java -jar server-0.41.2-java8.jar -dataFolder /home/pi/Blynk


Do you have any idea what I’m missing during installation?

0 Likes

#10

Heh… I actually knew that part. I just guess I am a bit of an oldskool geek, I like my Local Servers to be Local and see no benefit in paying all sorts of additional monthly subscriptions for something small like a Blynk Server that I can just as easily have on existing hardware for $free.nintynine And still access it on all the globetrotting outings I do every 2nd Sunday… Well… I believe I could… there is still that whole “Get dressed and leave the house” issue to work on… :rofl:

achievment

Strange as it might seem, what with using Blynk for over two years and living in this forum most every day… I am not as into IoT and IoT connected everything including the toilet paper roll as some… I use Blynk mostly for the GUI :blush:

But rest assured, as I find needs & resources to learn something, I can, will and do :slight_smile:

1 Like

#11

You need to use HTTPS://

Although the Certificate will still show as invalid. There was something in this forum about that, but the admin page is not really useful yet, so I rarely use/worry about it.

0 Likes

#12

so, first thing, you’ve somehow re-written your port 80.
guessing your other vhosts are broken at this point.

second, you want to put this jar file in an new ?? /var/www/Blynk ?? directory … some new server directory since you’re not running on a pi.

lets go back a step. get it so your normal webservers are up and running just fine, THEN

sudo apt-get install php

php -S localhost:8080 -t /var/www/html/ << starts up a web server here
Can you web into
http://139.59.21.5:8080 << default blank apache page

and do the same for 9443

php -S localhost:9443 -t /var/www/html/
<< http to it, see if its open as well.

If you cannot… we have to work on your iptables.

0 Likes

#13

Hi,

Thanks for your reply.

Looks like Gunner already showed where I’m wrong. It’s “https:” that is “s” is what missing in the url which is what creating an issue.

Now I’m able to open the server page!! (Thanks to @Gunner)

Here it is: https://139.59.21.5:9443/admin (test server)

I will try to repeat the process on the new server and I will update here again the issue is with https itself or not.

0 Likes

#14

awesome! off and running.

just a small tip… after you’ve created your own account…
add this to your server.properties file

initial.energy=0

incase anyone gets on your server, they can create acct’s but will have no energy to do anything, so the acct activity will be minimal.

0 Likes

#15

Doh… foiled again :innocent:

0 Likes

#16

Actually, this is just a blank server (means no apache and all). My goal is to see if blynk works with apache server so I can run blynk and my web server (apache) both on same VPS.

I give it a try and I will update here or ask help if req’d :wink:

1 Like

#17

Update:

My answer to this question is, YES. We can run apache and blynk on the same server (as per my test result on test server setup).

We can still access Blynk server without actually running port forwarding commands.

Thanks @lvennard I was actually missing this step on my server so I was not able to access my blynk admin page. After running a few test server setup, I noticed I need to run those commands to enable 8080 and 9443 ports on my ubuntu server.

Thanks a lot.

Yes. This is another thing that I missed during accessing the blynk server admin page. Thanks a lot, @Gunner for pointing the issue.

Finally, I successfully setup blynk on my VPS.

I was actually trying to install blynk on my VPS several days but I’m failing by missing those two-steps. Finally, I thought to post here after trying all possible ways. Anyway, really thanks @Gunner and @lvennard for helping.

2 Likes