0

I'm trying to install Nginx on an EC2 instance running Amazon Linux 2. After running the commands as listed here on: https://stackoverflow.com/a/61256478/11309912.

Checking the version shows that is installed.

nginx -v
nginx version: nginx/1.22.0

But either under /etc or /local there is no nginx folder being created.

nginx -t does run but fails:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2022/11/13 13:33:46 [emerg] 16016#16016: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

I tried running sudo yum remove nginx and sudo yum install nginx/sudo amazon-linux-extras install -y nginx1 but both to no avail.

Is there a way to (re)install nginx that places these folders and configs?

SB18
  • 33
  • 3

1 Answers1

1

The default document root directory for Nginx on Ubuntu and Debian is /var/www/html, while on CentOS and RHEL it is /usr/share/nginx/html. This is where you should place your web content, such as HTML, CSS, and JavaScript files.

so i think the location you are looking for is /usr/share/nginx/html