1、安装php7.1#添加php源sudoadd-apt-repositoryppa:ondrej/php#更新apt数据,加载php源数据sudoaptupdate#安装php-fpmsudoaptinstallphp7.1-fpmsudoaptinstallphp7。12.安装nginxsudoaptinstallnginx3.为laravel5.5安装php扩展sudoaptinstallphp7.1-mysqlmcryptphp7.1-mcryptphp7.1-mbstringphp7.1-xmlopenssl4.配置php配置sudovim/etc/php/7.1/fpm/php.ini找到cgi.fix_pathinfo,改成0,如下:cgi.fix_pathinfo=0保存退出,因为这可能是一个安全漏洞。五、为laravel配置nginxsudovi/etc/nginx/sites-enabled/defaultserver{listen80default_server;听[::]:80默认服务器;#SSL配置##listen443ssldefault_server;#听[::]:443ssldefault_server;##注意:您应该为SSL流量禁用gzip。#请参阅:https://bugs.debian.org/773332##阅读ssl_ciphers以确保安全配置。#请参阅:https://bugs.debian.org/765782##由ssl-cert包生成的自签名证书#不要在生产服务器中使用它们!##包括desnippets/snakeoil.conf;根/var/www/html/auth/public;#如果您使用的是PHP索引,请将index.php添加到列表中index.phpindex.htmlindex.htmindex.nginx-debian.html;服务器名称_;location/{#首先尝试将请求作为文件提供,然后#作为目录,然后返回显示404。try_files$uri$uri//index.php?$query_string;}#将PHP脚本传递给侦听127.0.0.1:9000的FastCGI服务器##location~\.php${#includesnippets/fastcgi-php.conf;###单独使用php7.0-cgi:#fastcgi_pass127.0.0.1:9000;##使用php7.0-fpm:#fastcgi_passunix:/run/php/php7.0-fpm.sock;#}location~\.php${includesnippets/fastcgi-php.conf;###单独使用php7.0-cgi:#fastcgi_pass127.0.0.1:9000;##使用php7.0-fpm:fastcgi_split_path_info^(.+\.php)(/.+)$;fastcgi_passunix:/var/run/php/php7.1-fpm.sock;#fastcgi_indexindex.php;包括fastcgi_params;}#拒绝访问.htaccess文件,如果Apache的文档根#与nginx的根一致##location~/\.ht{#denyall;#}location~/\.(?!well-known).*{denyall;}}
