I have a script that does a fair bit of sed
substitution and it all works baring this one line.
The odd thing is it works fine when I just run it normally on the terminal.
The code I want to substitute is part of this block:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Particularly this line: fastcgi_pass unix:/var/run/php-fpm.sock;
I want to change.
Here's the code I use to attempt to substitute it:
sed -i "s#fastcgi_pass unix:/var/run/php-fpm.sock;#fastcgi_pass unix:/var/run/php7.0-fpm.sock;#" /etc/nginx/sites-available/lemp-stack.app
For some reason it just doesn't substitute.
Does anybody have any ideas?
Thank you.
如果是这种情况,在pass
和unix
之间可能会有一个制表符而不是空格,这应该可以工作:
sed "s#fastcgi_pass[ \t]unix:/var/run/php-fpm.sock;#fastcgi_pass unix:/var/run/php7.0-fpm.sock;#"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.