Nginx + php on Ubuntu - configure nginx/php to show local site on domain.ltd

Job ID: 35385480

Budget: $10 – $30 USD

On my Ubuntu 20.04 laptop I Installed:
Php 7.2
Nginx
MariaDB

=====
I imported Wordpress DB it works fine with data in wp-config.php.
I put the wordpress files.
=====

My domain is www.example.com - and it of course shows the remote server.

But what I need is the domain www.example.com to show the local website that is running on the same laptop.
For this reason in /etc/hosts I added
127.0.0.1 www.example.com
127.0.0.1 example.com

Problem:
-the website does not load.
-html files are being shown well. for example www.example.com/test.html
-php files take forever to load and then they go to timeout

There is something wrong somewhere. I need help to make it working.

Final effect:
If I go to www.example.com the local site on the local laptop should be shown instead of the remote (real) site www.example.com.
If I remove the 2 lines from /etc/hosts the domain should show the site hosted remotely that is reachable from the whole world.


I need help to make it working. The help should be done via Desktop Sharing, for example Zoom / Google Meets.
Related categories: PHP Linux Apache Nginx MySQL