Reputation: 299
Installing Script using sudo bash using PHP Version 7.0.23-1+ubuntu16.04.1+deb.sury.org+1 generating error. this is the Nginx Config file.
#CREATING NGINX CONFIG FILES FOR EXAMPLE.COM
tee /etc/nginx/sites-available/$example_com << EOF
server {
listen 80;
root /var/www/$example_com;
index index.php index.html index.htm;
server_name $example_com;
location / {
try_files \$uri \$uri/ /index.php?q=\$uri&\$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php\$ {
try_files \$uri =404;
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
EOF
ln -sF /etc/nginx/sites-available/$example_com /etc/nginx/sites-enabled/$example_com
rm -rf /etc/nginx/sites-available/default &>> /dev/null
service nginx restart >> $TEMP 2>&1
if [ $? -eq 0 ]; then
ee_info "Nginx is successfull installed"
else
ee_fail "ERROR! Use:>>>sudo nginx -t<<<< in Terminal"
fi
service php7.0-fpm restart >> $TEMP 2>&1
ee_fail "The above is your config file."
Generating this Error while running full script on server.
root@ubuntu-xenial:/home/ubuntu# nginx -t
nginx: [emerg] invalid number of arguments in "fastcgi_param" directive in /etc/nginx/sites-enabled/test1.com:28
nginx: configuration file /etc/nginx/nginx.conf test failed
Please help me resolving this issue.
Upvotes: 0
Views: 495
Reputation: 146630
Problem is this statement
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
You didn't escape the $
for this
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
Upvotes: 1