Author Archives: Tomasz Jarzyński

Tomasz Jarzyński

Cześć. Mam na imię Tomasz. Mój cel na 2016 rok? Opisać 20 różnych wzorców projektowych na tym blogu.

MySql doesn’t accept polish letters [Music no 12]

I had a problem to make insert to database like that:

I got an error:

#1366 – Incorrect string value: ‚\xC4\x99d\xC4\x99 …’ for column ‚Name’ at row 1

After small investigation I found out that each column in mysql has itself encoding. To allow polish encoding in column name I had to set encoding to ‚utf8’ or ‚utf8_polish_ci’.

How to allow remote connection to mysql [Music no 11]

In the previous blog post, I show how to create MySQL database on linux server. I was able to access that MySQL, create db, create users and so on. The music application which is no the server is able to use this db. BUT! Nobody can access that database from outside. I am not able to connect from my localhost to my database on Linux server. How I can handle that?

So my application on server has a pretty straightforad connection string:

But the very same connection won’t work on my localhost. So what I have to do? First I go /etc/mysql/mysql.conf.d/mysqld.cnf and edit line with:

read more

How to disable SSH login for the root user on Linux? [Music no 10]

I had a problem that sometimes somebody hacked my password to my Linux server and run some programs on my Linux server. Every time when I decided to rebuild my Linux distribution on the server and change password to more crazy after a few months this happened
again – somebody hacked access to my Linux.

I digged a little bit and quickly I found the solution. I just turn off an option to be able to login as root user
Go to file: /etc/ssh/sshd_config
Find a line with text: #PermitRootLogin yes
Change it to: PermitRootLogin no
Confirm with: sudo service ssh restart

Confirm with
Save and done.

Set up .NET Core project in Linux with Nginx [Music no 9]

This post is continuation of previous one.

I created new folder where I’ll have production code:

Then I clone repo to that place

I use User Secrets approach. So I need to create specific folder and copy there my secrect.josn

To run my application I go to specific folder and just run it :).

I added file /etc/nginx/site-available/<live>.<>

read more

How To Install Nginx, MySQL, PHP, PhpMyAdmin, .NET Core in Ubuntu 18.04 [Music no 8]

I wrote this post because I tried to have on one Linux server .NET Core app and MySQL with PhpMyAdmin tool. On the Internet I found how to do it on 16.04, but it doesn’t work as ease as it is written on 18.04.

I wrote that post base on articles: and

Login to linux as root. First add a new user with sudo permissions:

You may log to the new one which you’ve just created and get all available updates to your Linux:

Then install server www and proxy server:

read more

OVH domain and Linode Domain [Music no 7]

I moved from to is cheaper and has more RAM and disk space. I followed that instruction to set up a new machine. It is worth to remember to google some promo code to get an extra start some extra dollars for new register users.

I decided to follow instructions from my post Hosting two websites on one linux server [Music no 5].

Moreover, I bought a new domain on ovh.

  1. First I had to set DNS servers. I went to Hit DNS Manager -> Add a domain zone read more

One code, two apps, different connection strings. How to managed that problem on core 2 [Music no 6]

I want to host two applications on one Linux server. One app for dev, another app for users. The problem which I have is that I try managed with sensitive data like connection string. Both databases (for dev and prod) are available on the Internet. Ideally, I want to write an app on the Windows, then push changes to GitHub, next go to console in Linux, get latest changes and build the app with proper commend either as the prod or as the dev build.

I don’t want to hardcode sensitive values in code or put them to a json file because by mistake I could commit that to GitHub. In that case, I decided to use SecretManager Tool in core 2. How is it work is nicely explained: and

My secret.json looks like that:

So with one code, I want to be able to choose which connection string I want to use without changing environment variables on Linux. In that case, I decided to run the app with some commands. The idea comes from

To select proper connection string I use that code:

And it’s work!



Other links:

Hosting two websites on one linux server [Music no 5]

I’ve already lost loads of time with my project. People could use my app for 2 weeks at least. But I try to improve that to make it better and more generic. All the time I check if everything is up and running on to Linux server. I came up with the idea to host two apps on one Linux server. The first one app will be a training ground, the second app will be production app. I looked for some solution how to host two apps on one server. At the begging, I struggled a little bit how to google that. but finally, I came up with the proper google phrase :).

I’ll try to follow steps from that link and I’ll see if it will work for me. I’ll go for the second option:
The one-domain, multiple subdomains approach.

But first I’ll create a subdomain ;). I’ll have to wait for 24 h for the propagation of new domain :).

Meantime I found 5 dollars/month vm comparison:

How to debug .net core 2 app on linux server via visual studio 2017 on windows? [Music no 4]

Follow those steps if the app is up and running 🙂

  1. Go to putty:
  2. Debug -> Attach to process
  3. Select Connection type: SSH and write Connection target:
    read more

How to set up Linux server for core 2 web app and make it visible on internet? Part 3 [Music no 3]

How to  publish site with Visual Studio 2017 to Linux server:



  1. Go to VS2017 and hit publish on project:
  2.  Set up debug mode on publish:
  3. read more

Powered by: Wordpress