I have installed nginx on Ununtu 18.04 but then un installed. After that deleted /etc/nginx/ directory.
Then again installed nginx with following command:
sudo apt install nginx
But when I am restarting it exits with following error:
Apr 04 17:29:34 bugs-VirtualBox nginx: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory) Apr 04 17:29:34 bugs-VirtualBox nginx: nginx: configuration file /etc/nginx/nginx.conf test failed Apr 04 17:29:34 bugs-VirtualBox systemd: nginx.service: Control process exited, code=exited status=1 Apr 04 17:29:34 bugs-VirtualBox systemd: nginx.service: Failed with result 'exit-code'. Apr 04 17:29:34 bugs-VirtualBox systemd: Failed to start A high performance web server and a reverse proxy server. -- Subject: Unit nginx.service has failed
How to resolve this?
You have purge compete installation with following command:
apt-get purge nginx nginx-common nginx-full
Then install with following command:
apt-get install nginx
After installation with these steps it worked again.