แก้ E: Sub-process /usr/bin/dpkg returned an error code (1)

ผมติดปัญหาตรงนี้โปรดสังเกต แต่ละคนจะไม่เหมือนกัน

dpkg: dependency problems prevent configuration of nginx

Setting up nginx-core (1.10.3-0ubuntu0.16.04.5) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-04-24 15:25:24 UTC; 15ms ago
  Process: 12690 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Apr 24 15:25:24 P1 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 24 15:25:24 P1 nginx[12690]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/sites-enabled/forum:17
Apr 24 15:25:24 P1 nginx[12690]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 24 15:25:24 P1 systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 24 15:25:24 P1 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Apr 24 15:25:24 P1 systemd[1]: nginx.service: Unit entered failed state.
Apr 24 15:25:24 P1 systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-core (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-core (>= 1.10.3-0ubuntu0.16.04.5) | nginx-full (>= 1.10.3-0ubuntu0.16.04.5) | nginx-light (>= 1.10.3-0ubuntu0.16.04.5) | nginx-extras (>= 1.10.3-0ubuntu0.16.04.5); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-core (<< 1.10.3-0ubuntu0.16.04.5.1~) | nginx-full (<< 1.10.3-0ubuntu0.16.04.5.1~) | nginx-light (<< 1.10.3-0ubuntu0.16.04.5.1~) | nginx-extras (<< 1.10.3-0ubuntu0.16.04.5.1~); however:
  Package nginx-core is not configured yet.
  Package nginx-full is not installed.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

ใช้คำสั่งเพื่อแก้ไข apt-get purge nginx nginx-common nginx-full