How to configure OPCache and nginx without modifying global php.ini?

Today, I migrated my NextCloud from shared hosting to a VPS. Right now, I keep getting the OPcache / php.ini configuration error. (" The PHP OPcache is not properly configured. For better performance it is recommended to use the following settings in the php.ini")

I was able to make the warning go away by modifying /etc/php/php7.1/php.ini but that effects the entire server. I want to restrict the php.ini changes to the one sub domain since I plan on installing another webapp on the same VPS under a separate subdomain.

Does anyone know if there is a way to do this? I realize this is more of an nginx question but I figured I’d check here since someone else may have already run into this situation. Thanks!

Alright. I’ve modified one of the things I was trying and found the solution. (I was previously entering new lines with \n)

fastcgi_param PHP_VALUE "opcache.enable=1 
    opcache.enable_cli=1 
    opcache.interned_strings_buffer=8 
    opcache.max_accelerated_files=10000 
    opcache.memory_consumption=128 
    opcache.save_comments=1 
    opcache.revalidate_freq=1";
1 Like