使用带有sudo bash脚本的Nginx配置安装错误

时间:2017-09-04 08:57:17

标签: php bash shell nginx

使用PHP版本7.0.23-1 + ubuntu16.04.1 + deb.sury.org + 1生成错误,使用sudo bash安装脚本。这是Nginx配置文件。

 #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."

在服务器上运行完整脚本时生成此错误。

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

请帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

问题是这个陈述

using Excel = Microsoft.Office.Interop.Excel; //namespace
var filePath = new 
FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +
            "\\Test" + "\\" + pathName + "\\" + subFile + "\\" + pathName + ".xlsx");

Excel.Application xlApp = new Excel.Application();
xlApp.Visible = true;
object misValue = System.Reflection.Missing.Value;

string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Test" + "\\" + pathName + "\\" + subFile + "\\" + pathName + ".xlsx";

if (filePath.Exists) // checks whether file exist or not
{
      Excel.Workbook wb = xlApp.Workbooks.Open(path,0, false, misValue, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false);
      Excel.Worksheet ws = (Excel.Worksheet)wb.Worksheets.Item["Sheet1"];
      for (int i = 0; i < dateTime.Count; i++)
      {
            // check element already there or not 
            if (ws.Cells[i + 1, 1].Value.ToString() != dateTime[dateTime.Count - i - 1])
            {
                  ws.Rows["1"].insert(); // add new row for new data
                  ws.Cells[1, 1] = dateTime[dateTime.Count - i - 1];
                  ws.Cells[1, 2] = firstTeam[dateTime.Count - i - 1];
                  ws.Cells[1, 3] = secondTeam[dateTime.Count - i - 1];
            }
      }
                wb.SaveAs(path, Excel.XlFileFormat.xlOpenXMLWorkbook, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlShared, misValue, misValue, misValue, misValue, misValue);
                wb.Close(true, misValue, misValue);
                xlApp.Quit();
}

你没有逃过fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 这个

$