Skip to content

Failed to start nginx.service when running standalone_ubuntu_oss_install.sh #90

@shawnhankim

Description

@shawnhankim

Describe the bug
Failed to start nginx.service when running nginx-s3-gateway as a Systemd Service using standalone_ubuntu_oss_install.sh

To Reproduce
Steps to reproduce the behavior:

  1. Create an IAM role
  2. Provision an EC2 instance which associates with AWS instance profile credentials.
  3. Switch user as a root via sudo su
  4. Install NGINX using standalone_ubuntu_oss_install.sh
  5. See the following errors:
    ▶ Starting NGINX
    Job for nginx.service failed because the control process exited with error code.
    See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

Expected behavior
The NGINX service should be successfully started as the following message:

▶ Creating NGINX configuration for S3 Gateway
▶ Creating directory for proxy cache
▶ Starting NGINX
root@ip-172-31-41-141:/home/ubuntu/nginx-s3-gateway-v2# ps -ef | grep nginx
root        2783       1  0 13:13 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx       2784    2783  0 13:13 ?        00:00:00 nginx: worker process
nginx       2785    2783  0 13:13 ?        00:00:00 nginx: cache manager process
nginx       2786    2783  0 13:13 ?        00:00:00 nginx: cache loader process
root        2787    2600  0 13:13 pts/3    00:00:00 systemctl status nginx.service

A clear and concise description of what you expected to happen.

Your environment

  • Version of the repo - master branch
  • Version of the container used (if downloaded from Docker Hub or Github): N/A
  • S3 backend implementation you are using (AWS, Ceph, NetApp StorageGrid, etc): AWS
  • How you are deploying Docker/Stand-alone, etc: Stand-alone
  • NGINX type: OSS
  • Authentication method (IAM, IAM with Fargate, IAM with K8S, AWS Credentials, etc): IAM

Additional context

Same error occurs when the following files do not exist:

  • cors.conf
  • js_fetch_trusted_certificate.conf
  • s3listing_location.conf
  • s3_location.conf
  • s3_server.conf

You could fine the error message as follows using the command of systemctl status nginx.service.

    root@ip-172-31-41-141:/home/ubuntu# systemctl status nginx.service
    × nginx.service - nginx - high performance web server
        Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
        Drop-In: /etc/systemd/system/nginx.service.d
                └─override.conf
        Active: failed (Result: exit-code) since Mon 2023-02-13 12:38:26 UTC; 35s ago
          Docs: https://nginx.org/en/docs/
        Process: 2463 ExecStartPre=/usr/local/bin/template_nginx_config.sh (code=exited, status=0/SUCCESS)
        Process: 2507 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
            CPU: 54ms

    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/js_fetch_trusted_certificat>
    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/cors.conf.template to /etc/>
    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/v4_js_vars.conf.template to>
    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/v4_headers.conf.template to>
    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/v2_headers.conf.template to>
    Feb 13 12:38:26 ip-172-31-41-141 template_nginx_config.sh[2476]: template_nginx_config.sh: Running envsubst on /etc/nginx/templates/gateway/s3_server.conf.template to >
    Feb 13 12:38:26 ip-172-31-41-141 nginx[2507]: nginx: [emerg] open() "/etc/nginx/conf.d/gateway/s3_location.conf" failed (2: No such file or directory) in /etc/nginx/co>
    Feb 13 12:38:26 ip-172-31-41-141 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
    Feb 13 12:38:26 ip-172-31-41-141 systemd[1]: nginx.service: Failed with result 'exit-code'.
    Feb 13 12:38:26 ip-172-31-41-141 systemd[1]: Failed to start nginx - high performance web server.

Sensitive Information
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions