Nginx fails to start for readonly filesystem
i am trying to configure nginx but by default it creates some directories at location /var/lib/nginx , /etc/nginx
i am looking for nginx to create these directories at a different location eg /tmp other than /var/lib , as /tmp is mounted as a different volume in the setup which i have currently where the filesystem is set to be readonly and when the filesystem is set to be readonly nginx fails with the error unable to mkdir()
How can i configure nginx to do so ?
i am able to add locations for access , error , body , fastcgi , scgi and uwsgi
Here is my conf file
which has been modified to
Check which user is running Nginx. By default, you can find this in the /etc/nginx/nginx.conf
file, specifically by looking for the user
directive (http://nginx.org/en/docs/ngx_core_module.html#user). After that, make sure that user has permission to read/write the paths you need.
The error you mentioned (Could not open error log file: open() '/var/log/nginx/error.log' failed (30: Read-only file system)
) might be happening because, since Nginx is unable to write to the specified paths, it tries to log the error to its default path (/var/log/nginx/error.log
). It’s possible that with the changes you're making, this path no longer exists.