How to use terminal to access logs

how to access the log using terminal

I am getting a 502 error NGINX GATEWAY

and to get assistance you need to understand UNIX which i don’t

Use the termial and start the look in the log with the user “root” or “normal user” and “sudo”

root:
tail -f /var/log/nginx/access.log
normal user and sudo:
sudo tail -f /var/log/nginx/access.log

Now reload website and look in the terminal.

https://www.tecmint.com/configure-custom-access-and-error-log-formats-in-nginx/

ok thats got the log going thank you

hi first up dont know if you can help with the problem below

  1. I have little knowledge of Servers
  2. The IT person set it up and left for the states and is not returning emails or crys for help
  3. when the server has been plugged into the network I get a 502 Nginx 1.14.0 Error (Ubuntu) 502 bad gateway
  4. I have no idea where to start to fix this previous work experience was a plumber lol or military
  5. Need help please but if possible step by step whether here on the terminal of the server or off the network
    6 Thank you in advance

log file is

admin@nextcloud:~$ tail -f /var/log/nginx/access.log
192.168.15.12 - - [31/Mar/2020:16:17:48 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:17:49 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:17:50 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.1 - - [31/Mar/2020:16:24:43 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:50 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:50 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.1 - - [31/Mar/2020:16:24:44 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://58.171.44.12/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:56 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:56 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:25:13 +0800] “HEAD / HTTP/1.1” 502 0 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

Hello
Can you show results of folllowing command :
sudo systemctl status nginx
sudo systemctl status mysql
sudo systemctl status php7.3-fpm.service

access.log is not the only log, check error.log too

I think that all the logs you have asked for are here please yell out if you need anything else

admin@nextcloud:~$ sudo systemctl status nginx
[sudo] password for admin:
Sorry, try again.
[sudo] password for admin:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: active (running) since Tue 2020-03-31 16:22:47 AWST; 1h 1min ago
Docs: man:nginx(8)
Process: 1851 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code
Process: 1758 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
Main PID: 1852 (nginx)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/nginx.service
├─1852 nginx: master process /usr/sbin/nginx -g daemon on; master_pro
├─1854 nginx: worker process
├─1856 nginx: worker process
├─1858 nginx: worker process
└─1859 nginx: worker process

Mar 31 16:22:46 nextcloud.ubuntu.com systemd[1]: Starting A high performance web
Mar 31 16:22:47 nextcloud.ubuntu.com systemd[1]: Started A high performance web
…skipping…
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: active (running) since Tue 2020-03-31 16:22:47 AWST; 1h 1min ago
Docs: man:nginx(8)
Process: 1851 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code
Process: 1758 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process
Main PID: 1852 (nginx)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/nginx.service
├─1852 nginx: master process /usr/sbin/nginx -g daemon on; master_pro
├─1854 nginx: worker process
├─1856 nginx: worker process
├─1858 nginx: worker process
└─1859 nginx: worker process

mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: active (running) since Tue 2020-03-31 16:22:57 AWST; 1h 4min ago
Process: 2011 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/my
Process: 1763 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exit
Main PID: 2013 (mysqld)
Tasks: 27 (limit: 4915)
CGroup: /system.slice/mysql.service
└─2013 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid

Mar 31 16:22:46 nextcloud.ubuntu.com systemd[1]: Starting MySQL Community Server
Mar 31 16:22:57 nextcloud.ubuntu.com systemd[1]: Started MySQL Community Server.

admin@nextcloud:~$ sudo systemctl php7.3-fpm.service
Unknown operation php7.3-fpm.service.
admin@nextcloud:~$

admin@nextcloud:~$ sudo tail -f /var/log/nginx/access.log
[sudo] password for admin:
192.168.15.12 - - [31/Mar/2020:16:17:48 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:17:49 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:17:50 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.1 - - [31/Mar/2020:16:24:43 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:50 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:50 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.1 - - [31/Mar/2020:16:24:44 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://58.171.44.12/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:56 +0800] “GET / HTTP/1.1” 502 584 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:24:56 +0800] “GET /favicon.ico HTTP/1.1” 502 584 “http://192.168.15.15/” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”
192.168.15.12 - - [31/Mar/2020:16:25:13 +0800] “HEAD / HTTP/1.1” 502 0 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36”

admin@nextcloud:~$ sudo tail -f /var/log/nginx/error.log
[sudo] password for admin:
2020/03/31 16:17:48 [crit] 1712#1712: *6181 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”, referrer: “http://192.168.15.15/
2020/03/31 16:17:49 [crit] 1712#1712: *6181 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”
2020/03/31 16:17:50 [crit] 1712#1712: *6181 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”, referrer: “http://192.168.15.15/
2020/03/31 16:24:43 [crit] 1854#1854: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.1, server: 192.168.0.214, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “58.171.44.12”
2020/03/31 16:24:50 [crit] 1856#1856: *4 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”
2020/03/31 16:24:50 [crit] 1856#1856: *4 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”, referrer: “http://192.168.15.15/
2020/03/31 16:24:44 [crit] 1854#1854: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.1, server: 192.168.0.214, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “58.171.44.12”, referrer: “http://58.171.44.12/
2020/03/31 16:24:56 [crit] 1856#1856: *5 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”
2020/03/31 16:24:56 [crit] 1856#1856: *5 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “192.168.15.15”, referrer: “http://192.168.15.15/
2020/03/31 16:25:13 [crit] 1854#1854: *11 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.15.12, server: 192.168.0.214, request: “HEAD / HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.0-fpm.sock:”, host: “nextcloud”

In the error.log, you have problem with php7.0-fpm.
Did you install php ? What is the version of your php ?
Try :

To know the version of php
php -r ‘echo PHP_VERSION; echo “\n” ;’

Check php service
sudo systemctl status php7.0-fpm.service

You can use auto-completion with tab ! (juste write php7. then press on tab twice and complete)

A php service must run.

I think that your nginx configuration is not complete
It is useful to document the services (or deamon) on Linux.

If it does not help post
dpkg -l |greep php
(shows installed ubuntu packages with the word “php”)

admin@nextcloud:~$ php -r ‘echo PHP_VERSION; echo “\n”

Command ‘php’ not found, but can be installed with:

sudo apt install php7.2-cli

“n”
admin@nextcloud:~

admin@nextcloud:~$ sudo apt install php7.2-cli
[sudo] password for admin:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following package was automatically installed and is no longer required:
libzip4
Use ‘sudo apt autoremove’ to remove it.
The following additional packages will be installed:
php7.2-common php7.2-json php7.2-opcache php7.2-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline
0 upgraded, 5 newly installed, 0 to remove and 4 not upgraded.
Need to get 2,542 kB of archives.
After this operation, 11.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]

hit (y)

ok its installing
do i reboot at the completion

sorry. Perhaps you do not use libapache2-mod-php .
But restart . I think libapache2-mod-php is no problem if not used.

Try:
sudo systemctl start php7.2-fpm

ok
will do

efault.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.
invoke-rc.d: initscript apache2, action “start” failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2020-03-31 18:43:11 AWST; 12ms ago
Process: 9478 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: Starting The Apache HTTP Server…
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: no listening sockets available, shutting down
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: AH00015: Unable to open logs
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: Action ‘start’ failed.
Mar 31 18:43:11 nextcloud.ubuntu.com apachectl[9478]: The Apache error log may have more information.
Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: apache2.service: Control process exited, code=exited status=1
Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: apache2.service: Failed with result ‘exit-code’.
Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: Failed to start The Apache HTTP Server.
Setting up php7.2-cli (7.2.24-0ubuntu0.18.04.3) …
update-alternatives: using /usr/bin/php7.2 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.2 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.2 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/7.2/cli/php.ini with new version
Setting up libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.3) …

Creating config file /etc/php/7.2/apache2/php.ini with new version
Module mpm_event disabled.
Enabling module mpm_prefork.
apache2_switch_mpm Switch to prefork
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.
invoke-rc.d: initscript apache2, action “restart” failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2020-03-31 18:43:23 AWST; 12ms ago
Process: 11273 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: Starting The Apache HTTP Server…
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: no listening sockets available, shutting down
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: AH00015: Unable to open logs
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: Action ‘start’ failed.
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11273]: The Apache error log may have more information.
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: apache2.service: Control process exited, code=exited status=1
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: apache2.service: Failed with result ‘exit-code’.
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: Failed to start The Apache HTTP Server.
apache2_invoke: Enable module php7.2
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.
invoke-rc.d: initscript apache2, action “restart” failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2020-03-31 18:43:23 AWST; 12ms ago
Process: 11385 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: Starting The Apache HTTP Server…
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: no listening sockets available, shutting down
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: AH00015: Unable to open logs
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: Action ‘start’ failed.
Mar 31 18:43:23 nextcloud.ubuntu.com apachectl[11385]: The Apache error log may have more information.
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: apache2.service: Control process exited, code=exited status=1
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: apache2.service: Failed with result ‘exit-code’.
Mar 31 18:43:23 nextcloud.ubuntu.com systemd[1]: Failed to start The Apache HTTP Server.
Setting up libapache2-mod-php (1:7.2+60ubuntu1) …
Processing triggers for systemd (237-3ubuntu10.39) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) …
Processing triggers for ureadahead (0.100.0-21) …
ureadahead will be reprofiled on next reboot
Processing triggers for php7.2-cli (7.2.24-0ubuntu0.18.04.3) …
Processing triggers for libapache2-mod-php7.2 (7.2.24-0ubuntu0.18.04.3) …

there was some errors
See “systemctl status apache2.service” and “journalctl -xe” for details.
invoke-rc.d: initscript apache2, action “start” failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Tue 2020-03-31 18:43:11 AWST; 12ms ago
Process: 9478 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

exited, code=exited status=1
Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: apache2.service: Failed with result ‘exit-code’.
Mar 31 18:43:11 nextcloud.ubuntu.com systemd[1]: Failed to start The Apache HTTP Server.
Setting up php7.2-cli (7.2.24-0ubuntu0.18.04.3) …
update-alternatives: using /usr/bin/php7.2 to provide /usr/bin/php (php) in auto mode

admin@nextcloud:~$ sudo systemctl start php7.2-fpm
Failed to start php7.2-fpm.service: Unit php7.2-fpm.service not found.
admin@nextcloud:~$

You want to use Nginx or Apache ? Because you cant run Nginx and Apache both. Choose and i will back to you all command to use to in order to install php…

This error means that you try to run apache while nginx is running
“Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80”

unfortunately i don’t know the difference between them this was setup by a IT person given to me as he left for the states and i am trying to work it out

All so the error i am getting is a 502 Bad Gateway error nginx/1.14.0

both trying to get to nextclould on the network and by the internet ip address

Perhaps you can temporary stop apache2 and test again.
sudo systemctl stop apache2.service

Then stop and start nginx:
sudo systemctl stop nginx
sudo systemctl start nginx

Hope it is correct.

admin@nextcloud:~$ sudo systemctl stop apache2.service
[sudo] password for admin:
admin@nextcloud:~$ sudo systemctl stop nginx.service
admin@nextcloud:~$ sudo systemctl start nginx.service
admin@nextcloud:~$

dont know if it done anything