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:

adduser myuser
sudo adduser myuser sudo

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

sudo apt-get update

Then install server www and proxy server:

sudo apt-get install nginx

Install MySql Server:

sudo apt-get install mysql-server

Install PHP. Currently, by default, php version 7.2 is installed. To run phpmyadmin it is required to have mcrypt installed. It is currently not available for 7.2. We need to get mcrpyt from php 7.1 and copy that file to 7.2. Additionally, the actual version of phpMyAdmin (4.6.6) needs also mbstring package.

sudo apt-get install php-fpm php-mysql
sudo apt-add-repository ppa:ondrej/php
sudo apt-get install php7.1-mbstring
sudo apt-get install php7.1-mcrypt
sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available/
sudo apt-get install php7.2-mbstring
sudo phpenmod mcrypt

Change PHP configuration /etc/php/7.2/fpm/php.ini.
Change ;cgi.fix_pathinfo=1 to cgi.fix_pathinfo=0 (line 778)
Add line (line 893)

Restart PHP service

sudo service php7.2-fpm restart

Change your nginx configuration/etc/nginx/sites-available/default

server {
     listen 80 default_server;
     listen [::]:80 default_server;

root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; 

server_name <>;
location / {
     try_files $uri $uri/ =404; 

location ~ \.php$ {
     include snippets/fastcgi-php.conf;
     fastcgi_pass unix:/run/php/php7.2-fpm.sock; 

location ~ /\.ht {
     deny all; 

Add to /var/www/html/index.php with following piece of code


First check if nginx is propely configured then run nginx service and check if PHP works fine under address: <>

sudo nginx -t
sudo systemctl restart nginx

Install PhpMyAdmin

sudo apt-get install phpmyadmin

During installation you will be promnt about web server. Skip it: TAB -> Enter. Later you will be asked if you like to configure dbconfig-common. Select yes and write twice password to a default user. Login to default user is phpmyadmin.

After installation make phpmyadmin visible your under address: <>/phpmyadmin.

sudo ln -s /usr/share/phpmyadmin /var/www/html

Create admin user in mysql server

mysql -u root -p 
GRANT ALL PRIVILEGES ON *.* TO 'youruser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;

For my own purposes I create different databases and different users with restricted access to that databases

GRANT ALL PRIVILEGES ON prod.* TO 'prod'@'localhost' IDENTIFIED BY 'prodpass';

GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost' IDENTIFIED BY 'testpass'; 

Install git

sudo apt-get install git-core

Install .net core (

wget -q
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

Leave a Comment

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są oznaczone *