Hi I would like to implement if condition on access and error log. Prior to nginx restart I want nginx to look for first log path location eg. /externalhdd/log/nginx/example.com_access.log, if log doesn't exist use second path which is /var/log/nginx/example.com_access.log I have given like my example. I guess I need some if conditions or something.
server {
listen 80;
server_name example.com;
root /var/www/example.com/public_html;
index index.php;
IF ACCESS LOG EXIST USE THIS PATH
access_log /externalhdd/log/nginx/example.com/logs/example.com_access.log;
IF ACCESS LOG DOESN'T EXIST USE THIS PATH
access_log /var/log/nginx/example.com/logs/example.com_access.log;
error_log /var/www/example.com/logs/example.com_error.log error;
location / {
index index.php index.html;
}