转载自Ubuntu 14/16下的Laravel LNMP线上环境自动部署脚本php
说明
此脚本用于在一台全新的 Ubuntu 14.04 LTS上部署适合 Laravel 使用的 LNMP 生产环境。
此脚本参照了 Homestead 环境设置脚本 ,并作了更加适用于生产环境的效率和安全调优。项目地址:https://github.com/summerblue/laravel-ubuntu-inithtml
wget https://raw.githubusercontent.com/summerblue/laravel-ubuntu-init/master/deploy.sh chmod +x deploy.sh
vi deploy.sh # Configure MYSQL_ROOT_PASSWORD="{{--Your Password--}}" MYSQL_NORMAL_USER="estuser" MYSQL_NORMAL_USER_PASSWORD="{{--Your Password--}}"
运行脚本
./deploy.sh
nginx
git clone
拉下项目到项目文件夹cd /data/www/{YOU PROJECT FOLDER NAME} chown www:www -R ./
server { listen 80; server_name {{---YOU-DOMAIN-NAME---}}; root "{{---YOU-PROJECT-FOLDER---}}"; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log /data/log/nginx/{{---YOU-PROJECT-NAME---}}-access.log; error_log /data/log/nginx/{{---YOU-PROJECT-NAME---}}-error.log error; sendfile off; client_max_body_size 100m; include fastcgi.conf; location ~ /\.ht { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
完成以后重启Nginx
service nginx restart
laravel