使用说明开始部署Laravel项目。服务器可以尝试使用vultr购买服务器操作系统。可以选择Ubuntu14.04x64,添加sshkey或password登录ubuntu系统来登录服务器。可以通过lsb_release-a信息查看版本apt-getapt-getupdate安装系统语言包sudoapt-getinstall-ylanguage-pack-en-basesetlanguagelocale-genen_US.UTF-8安装常用工具sudoapt-getinstall-yvimhtopgitinstallppa执行前sudoapt-getinstall-ysoftware-properties-common安装ppasudoLC_ALL=en_US.UTF-8add-apt-repositoryppa:ondrej/php拉取最新包sudoapt-getupdate查找php7.1版本包apt-cachesearchphp7.1installphp7.1apt-getinstall-yphp7.1installextension:php7.1-mysqlapt-getinstall-yphp7.1-mysql安装扩展:php7.1-fpmapt-getinstall-yphp7.1-fpm安装其他扩展:php7.1-...apt-getinstall-yphp7.1-curlphp7.1-xmlphp7.1-mcryptphp7.1-jsonphp7.1-gdphp7.1-mbstringinstallNginx+MySQLsudoapt-getinstall-ymysql-server-5.6sudoapt-getinstall-ynginxconfigurationlnmp打开php配置文件php.inisudovi/etc/php/7.1/fpm/php.ini,启用和修改确认配置项cgi_fix_pathinfo=0打开php-fpm配置文件www.confsudovi/etc/php7.1/fpm/pool.d/www.conf,最好修改配置项listen=/var/run/php7.1-fpm.sock打开Nginx配置文件defaultsudovi/etc/nginx/sites-available/default,修改itsroot,location,server_name创建项目根目录mkdir/var/wwwsudochownwww-data:www-data/var/www从github拉取完整的项目目录,composerinstall,composerinstall,sudochmod-R775storage/sudochown-Rwww-data:www-data/var/www/project复制.env文件,修改基本配置index.phpindex.htmlindex.html;server_namelocalhostwww.example.com;location/{try_files$uri$uri//index.php?$query_string;}#传递php脚本位置~\.php${try_files$uri/index.php=404;fastcgi_split_path_info^(.+\.php)(/.*)$;fastcgi_passunix:/var/run/php7.1-fpm.sock;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}域名解析修改Nginx配置文件server_namewww.domain.com使用DNSpod,修改A记录的记录值为服务器名网络IP,在你注册域名的地方添加两条记录,和修改其DNS值ssl证书推荐Let'sEncrypt也可以选择使用startssl的免费ssl证书使用startssl账号登录,在首页选择ValidationsWizard验证域名所有者信息,验证通过后申请免费证书成功,在输入框最多申请5个域名ssl证书粘贴命令生成csr文件。第一步是设置解密文件的密码,然后按照提示输入CN,Beijing,Beijing,orgInc...将生成的csr文件粘贴到网站输入框,提交后很快就会发出下载证书,把证书文件夹下载到本地,找到Nginx.zip,解压crt文件上传到远程服务器,那么远程服务器现在应该有三个文件,一个是刚刚上传的证书的crt文件,一种是提交申请证书生成的csr文件,一种是提交证书生成的服务器密钥文件。解密服务器密钥文件,再次进入startssl网站,在首页工具箱中找到解密私钥,输入密码,生成解密后的服务器密钥,修改Nginx配置文件,打开配置443ssl的服务器,修改其ssl_certificatedemo.crtssl_certificate_keydemo.key,执行sudoservicenginxconfigtest测试配置文件是否被修改。OK修改Nginx配置文件,打开配置为80的服务器,添加一行return301https://domain.com$request_uri使其在访问80端口时直接重定向到443。检查https网站的安全性并访问-->sslabs,两分钟左右得到测试结果报告。为了让你的网站达到A标准,可以参考server-configs-nginx,catserver-configs-nginx/h5bp/directive-only/ssl.conf复制其ssl_ciphers,ssl_protocols,ssl_prefer_server_ciphers,keepalive_timeout配置项重新加载conf或使用MozillaSSLConfigurationnGenerator生成标准的sslconf
